Access Google Drive from Linux Command Line

Posted by:


Gdrive (ver.2) Installation and Configuration

  1. Download the Linux version of gdrive from GitHub.

  2. You should see a file in your home directory called something list uc=0B3X9GlR6EmbnWksyTEtCM0VfaFE. Rename this file to gdrive.

  3. Assign this file executable rights.

  4. Install the file to your usr folder.

  5. connect to your google drive account

    The first time gdrive is launched (i.e. run gdrive about in your terminal not just gdrive), you will be prompted for a verification code. The code is obtained by following the printed url and authenticating with the google account for the drive you want access to. This will create a token file inside the .gdrive folder in your home directory.

    for multiple gdrive account:

    If you want to manage multiple drives you can use the global config{<i>php} flag or set the environment variable {php}GDRIVE_CONFIG_DIR. Example: GDRIVE_CONFIG_DIR=/home/user</i>.gdrive-secondary gdrive list You will be prompted for a new verification code if the folder does not exist.


basic usage:

gdrive [global] list [options] List files
gdrive [global] download [options] <fileId> Download file or directory
gdrive [global] download query [options] <query> Download all files and directories matching query
gdrive [global] upload [options] <path> Upload file or directory
gdrive [global] upload – [options] <name> Upload file from stdin
gdrive [global] update [options] <fileId> <path> Update file, this creates a new revision of the file
gdrive [global] info [options] <fileId> Show file info
gdrive [global] mkdir [options] <name> Create directory
gdrive [global] share [options] <fileId> Share file or directory
gdrive [global] share list <fileId> List files permissions
gdrive [global] share revoke <fileId> <permissionId> Revoke permission
gdrive [global] delete [options] <fileId> Delete file or directory
gdrive [global] sync list [options] List all syncable directories on drive
gdrive [global] sync content [options] <fileId> List content of syncable directory
gdrive [global] sync download [options] <fileId> <path> Sync drive directory to local directory
gdrive [global] sync upload [options] <path> <fileId> Sync local directory to drive
gdrive [global] changes [options] List file changes
gdrive [global] revision list [options] <fileId> List file revisions
gdrive [global] revision download [options] <fileId> <revId> Download revision
gdrive [global] revision delete <fileId> <revId> Delete file revision
gdrive [global] import [options] <path> Upload and convert file to a google document,
gdrive [global] export [options] <fileId> Export a google document
gdrive [global] about [options] Google drive metadata, quota usage
gdrive [global] about import Show supported import formats
gdrive [global] about export Show supported export formats
gdrive version Print application version
gdrive help Print help
gdrive help <command> Print command help
gdrive help <command> <subcommand> Print subcommand help


  1. see ’about import’ for available conversions | see ’about import’ for available conversions|
  2. operate on fileId, not file name, obtain from gdrive list
  3. upload download upload and download file or folders without converting
  4. import export convert to and from google docs in addtion to up/download.
  5. -mime to change tape

Some useful usages

  1. Create directory

  2. Show file info

  3. Share file or directory

Import and Export Files Between Google Drive and Emacs


Inspired from here.

upload or download file from emacs buffer to google drive

import and export between emacs and google drive with conversion

How to mount google drive as a virtual file system

How To Mount Google Drive Locally As Virtual File System In Linux


Add a Comment