Download Google Drive Files on Linux via Command Line
Have you ever found yourself needing to download a file from Google Drive on your Linux system, and you prefer a command-line approach? gdown
, a tool designed to streamline file downloads without the need for a graphical interface. In the Linux environment, where GUI interactions are often limited, gdown
proves to be a valuable asset for effortlessly retrieving files from Google Drive using simple command-line commands. Let's explore how you can enhance your file-downloading experience on Linux through CLI.
Prerequisites
Before we begin, ensure you have Python and pip3 installed on your system. While most Linux distributions come with Python pre-installed, you may need to install pip3 separately.
To install pip3 on Ubuntu, run the following commands:
sudo apt update
sudo apt install python3-pip
This will install pip3, the package installer for Python 3.
Installing gdown
Now that we have pip3 installed, we can proceed to install gdown
. Open your terminal and use the following command:
pip3 install gdown
This command installs gdown
and its dependencies, making it ready for use.
Downloading a File from Google Drive
Once you have gdown
installed, you can use it to download a file from Google Drive by providing the file's Google Drive ID. Here's a step-by-step guide:
1. Obtain the Google Drive File ID:
To download a file from Google Drive using gdown
, you'll need the file's unique ID. Follow these steps to obtain the file ID:
* Share the File:
- Open your Google Drive and locate the file you want to download.
- Right-click on the file and select “Share.”
- In the sharing dialog, click on “Copy link.”
- The link will look like
https://drive.google.com/file/d/FILE_ID/view
* Extract the File ID:
- Paste the link into a text editor or directly into the terminal.
- Extract the
FILE_ID
from the link. It is the long string of characters between "https://drive.google.com/file/d/" and "/view".
2. Use gdown to Download the File:
- Open your terminal and use the following command:
gdown https://drive.google.com/uc?id=YOUR_FILE_ID
- Replace
YOUR_FILE_ID
with the actual Google Drive File ID you obtained in the previous step. - The file will be downloaded to your current working directory.
Additional Options
gdown
provides additional options to customize your download:
- Specifying Output File Name:
You can use the -O
option to specify the output file name. For example:
gdown https://drive.google.com/uc?id=example_file_id -o output_file.txt
- Resuming an Interrupted Download:
If your download is interrupted, you can use the -c
option to resume it:
gdown https://drive.google.com/uc?id=example_file_id -c
- Limiting Download Speed:
You can limit the download speed using the --limit-rate
option:
gdown https://drive.google.com/uc?id=example_file_id --limit-rate 100k
Conclusion
gdown
streamlines the process of downloading files from Google Drive in a Linux environment. With just a few commands, you can effortlessly retrieve the files you need without the need for a graphical interface. Give it a try and enhance your file-downloading experience on Ubuntu!
Happy downloading!
Thank you for taking the time to read my article! If you found this article helpful, please feel free to share it with your network. And if you’d like to stay connected and be the first to know when I publish new content, don’t hesitate to connect with me on LinkedIn. Let’s continue the conversation there!