Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Download Google Drive files from linux terminal via wget


  1. Add this code to your ~/.bash_aliases file.
function gdrive_download () {
  CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "$1" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')
  wget --load-cookies /tmp/cookies.txt "$CONFIRM&id=$1" -O $2
  rm -rf /tmp/cookies.txt
  1. Open new bash session.


gdrive_download long_google_drive_file_id filename.ext

This comment has been minimized.

Copy link
Owner Author

commented May 16, 2019

created this gist from the original one:


This comment has been minimized.

Copy link

commented Jun 3, 2019

Works for me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.