Download from Google Drive using Command Line Interface (CLI)

Download from Google Drive using Command Line Interface (CLI), using curl, Linux, MacOS, Windows

In this tutorial, I will share How to Download a File in Google Drive using Command Line Interface, using this script you can download a file without file size limitation, maybe you can use gdown but gdown sometimes still error if you download a big file from Google Drive

Before Download a Big File, Create OAuth Authentication First

This script also same if you don’t configure first, can’t download a big file from Google Drive, so you must create OAuth Credentials first

  1. Login to Google Developer Console and Create Project first
    • Note: If you don’t have project Click on Select ProjectNew Project
Click to Show Image

  1. Click Hamburger menu on the left → Select API & ServicesSelect Library
Click to Show Image

  1. Search for Google Drive API and Enable Google Drive API
Click to Show Image

  1. Click Credentials on left pane and Click + CREATE CREDENTIALS and select OAuth Client ID
Click to Show Image

Note: If you face this error, click on CONFIGURE CONSENT SCREEN

Click to Show Image

  • Select External and click CREATE
Click to Show Image

  • Just fill in the section
    • App name *
    • User support email
    • Email addresses
  • Click SAVE AND CONTINUE until Step 4 and Click Publish in the Production section
  • Back to Create Credentials
  1. After select OAuth Client ID
    • Application type select Desktop app
    • Name fill whatever you want
    • Click CREATE
  2. If success, you will get Client ID and Client Secret, Save it.
Click to Show Image

Download a File From Google Drive

  1. This script you can find it in Official GitHub Repository
  2. To install this script, just execute command
curl -Ls --compressed | sh -s

alternatively, you can use the original github url instead of

curl -Ls --compressed | sh -s
  1. This script installed at ${HOME}/.gdrive-downloader/
  2. To Download a File from Google Drive (Especially big file) use command
gdl -o driveID

Click to Show Image

  1. And you will be asked to put (Only one time), and this config file saved in ${HOME}/.gdl.conf
    • Client ID → Fill in the client ID with the one you created earlier
    • Client Secret → Fill in the client Secret with the one you created earlier
    • Refresh Token → Just blank and hit enter
    • And the link will appear, click on that link to get authorization code
      Click to Show Image

      • Login with your Google Account
        Click to Show Image

      • In this case Warning like this is normal, because app we create earlier is not verified by Google, so just click show advanced and click Go to yourappname (unsafe)
        Click to Show Image

      • Click Allow
        Click to Show Image

      • Click Allow Again
        Click to Show Image

      • And you get authorization code copy and paste to terminal console
        Click to Show Image

  2. And file will be downloaded immediately
Click to Show Image

If you want to download a big file again, just use command gdl -o driveID and will not be asked to enter the auth code.

For Documentation, you can see in GitHub Repository

Special Thanks to: Akianonymus for making a great script!

Bantu bagikan halaman ini ke:
Dibangun dengan Hugo
Tema Stack dirancang oleh Jimmy