Ugacomp

How can I download files from Google Drive using Linux Terminal?

Where necessary, you may need to have access to a VPS server so you can follow how to implement the steps in this article.  You can get a cheaper VPS Server from Contabo with 4vCPU cores, 8GM RAM, and 32TB Bandwidth for less than $5.50 per month. Get this deal here now

Table of Contents

Cloud VPS S

$5.50 Monthly
  • 4 vCPU Cores | 8GB RAM

CLOUD VPS M

$15.50 Monthly
  • 6 vCPU Cores | 16GB RAM

CLOUD VPS L

$17.50 Monthly
  • 8 vCPU Cores | 24GB RAM

You can download Files from Google Drive using the Linux terminal by completing the following steps:

Change Google Drive file permission

The first thing you need to do is to change the permission access to your file in Google Drive to “Anyone with your link“. See the image below for your reference:

To change the permission, you have to right-click on the target file you want to download and then select share. After that, you will go to the General Access settings, click the dropdown, and select “anyone with the link

Once you’ve selected this setting, you will need to copy the file link and paste it somewhere and will use this link later.

Install Gdown on Linux

gdown is a command-line tool used to download large files from Google Drive. It is a Python-based tool that uses the Google Drive API to download files. It simplifies the process of downloading large files from Google Drive, as it handles the authentication process and uses multiple connections to download the file in parallel, which can significantly speed up the download process.

Install python3 and pip

To install gdown, we need to first install both python3 and pip. gdown is a Python-based tool, and was written in the Python programming language. Specifically, Python 3 has to be installed on your system in order to run it.

On the other hand, pip is a package manager for Python that allows you to easily install and manage Python packages. When you install gdown using pip, it will automatically install any dependencies that gdown requires, such as the Google API Python client. This ensures that you have all the necessary packages installed and configured to use gdown properly on your system.

To install both python 3 and pip in one command, run the following command on your Linux terminal:

sudo apt install python3-pip

Use pip to install gdown

Since we already have both python 3 and pip installed on our machine, we can now install gdown by running the following command;

sudo pip install gdown

Download the Google Drive file using gdown

To finally download the file from Google Drive, we will have to do the following:

Extract the file ID

The Google Drive file ID is a unique identifier that Google assigns to each file stored on Google Drive. It is a long string of characters that identifies the file and distinguishes it from other files in your Google Drive. You can find the file ID in the URL of the file you want to download or share.

For example, assuming you have a Google Drive file with the following URL:

https://drive.google.com/file/d/1aBcDeFgHiJkLmNoPqRsTuVWxYz/edit

From the above URL, the file ID is: “1aBcDeFgHiJkLmNoPqRsTuVWxYz“. See also the image below for your reference:

When you want to download a file from Google Drive using gdown, you need to provide the file ID as an argument to the gdown command. This tells gdown which file to download from Google Drive.

For example, assuming your Google Drive file has a file ID, 13LIozVdk9TksBrccgFbTI2zDn3B33aEF, the download URL you’re going to use will be: https://drive.google.com/uc?id=13LIozVdk9TksBrccgFbTI2zDn3B33aEF

And now, we can run the download command as follows:

sudo gdown https://drive.google.com/uc?id=13LIozVdk9TksBrccgFbTI2zDn3B33aEFWha

All you have to do is to copy the above command, and you need to put your own file ID and run it on your Linux terminal.

What about wget for downloads?

While you can download files from Google Drive using wget, it is not recommended because it requires an additional step of manually obtaining a direct download link from the Google Drive website, which can be cumbersome, and sometimes the links are temporary and may expire.

Google Drive has a specific set of APIs that are designed to enable programmatic access to its contents. When downloading files from Google Drive, it’s recommended to use a tool that utilizes the Google Drive API, like gdown, which is a Python-based tool that uses the Google Drive API to download files.

Using the Google Drive API ensures that the download link is valid, and you have the correct permissions to download the file. It also ensures that the download process is more reliable and less likely to encounter errors, especially when dealing with large files. gdown also allows for parallel downloading and resumable downloads, which can significantly improve the download speed and experience.

So, while wget can be used to download files from Google Drive, it is not recommended because it requires additional steps to obtain the correct download link and may be less reliable for large files. It’s recommended to use a tool that utilizes the Google Drive API, such as gdown

Hire us to handle what you want

Hire us through our Fiverr Profile and leave all the complicated & technical stuff to us. Here are some of the things we can do for you:

  • Website migration, troubleshooting, and maintenance.
  • Server & application deployment, scaling, troubleshooting, and maintenance
  • Deployment of Kubernetes, Docker, Cloudron, Ant Media, Apache, Nginx,  OpenVPN, cPanel, WHMCS, WordPress, and more
  • Everything you need on AWS, IBM Cloud, GCP, Azure, Oracle Cloud, Alibaba Cloud, Linode, Contabo, DigitalOcean, Ionos, Vultr, GoDaddy, HostGator, Namecheap, DreamHost, and more.
 

We will design, configure, deploy, or troubleshoot anything you want. Starting from $10, we will get your job done in the shortest time possible. Your payment is safe with Fiverr as we will only be paid once your project is completed.