LinuxCommandLibrary

gdrive

Manage Google Drive files from the command line

TLDR

Upload a local path to the parent folder with the specified ID

$ gdrive upload [[-p|--parent]] [id] [path/to/file_or_folder]
copy

Download file or directory by ID to current directory
$ gdrive download [id]
copy

Download to a given local path by its ID
$ gdrive download --path [path/to/folder] [id]
copy

Create a new revision of an ID using a given file or folder
$ gdrive update [id] [path/to/file_or_folder]
copy

SYNOPSIS

gdrive [global-options] command [command-options] [arguments]

PARAMETERS

about
    Display Google Drive account info and quotas

list [-m max] [-r]
    List files/folders; -m limits count, -r recursive

upload [-r] [-p parent-id/path] [-c]
    Upload file(s); -r recursive, -p to folder, -c absolute path

download id [filename]
    Download file/folder by ID; supports -r recursive

mkdir name
    Create new folder

delete [-r] id
    Delete file/folder; -r recursive

info id/path
    Show file/folder details

share [-r] [-t type] id email
    Share with email; -t reader/writer/commenter

unshare id email
    Remove sharing permission

move [-p parent] id
    Move file/folder

trash id
    Move to trash

untrash id
    Restore from trash

edit [-t title] [-n name] id
    Update title/description

--config dir
    Global: Set token/config directory (default ~/.gdrive)

--timeout seconds
    Global: HTTP request timeout

--quiet
    Global: Suppress progress output

--scope scope
    Global: OAuth scope (drive, drive.readonly, etc.)

DESCRIPTION

gdrive is a lightweight, open-source command-line tool written in Go for interacting with Google Drive from Linux terminals. It enables seamless file and folder management, including uploading, downloading, listing, deleting, sharing, moving, and editing metadata, without needing a graphical interface or browser after initial setup.

Users authenticate once via OAuth 2.0, generating tokens stored in ~/.gdrive (configurable). Features like recursive operations (-r), progress indicators, resumable uploads for large files, absolute/relative paths, and permission controls (reader/writer/commenter) make it powerful for scripting, backups, and automation on servers.

Unlike FUSE-based tools, it doesn't mount Drive as a filesystem, focusing instead on direct API calls for speed and low overhead. It's ideal for headless environments but respects Google API quotas (e.g., 750GB/day upload). Widely used since 2013, though modern alternatives like rclone offer more features.

CAVEATS

Third-party tool, not official Google product; requires initial browser auth; hits API rate limits (e.g., 1000 queries/100s); no real-time sync; large uploads may need resume handling.

INSTALLATION

Download static binary from GitHub releases matching your architecture, make executable: chmod +x gdrive, move to /usr/local/bin.

FIRST-TIME AUTH

Run gdrive about; opens browser for OAuth consent. Tokens save to ~/.gdrive. Use custom client ID for heavy use (via Google API Console).

HISTORY

Created by Petter Rasmussen in 2013 as a simple Go-based CLI for Google Drive API v2 (later v3). Hosted on GitHub (prasmussen/gdrive) with 5k+ stars; peaked in popularity pre-rclone era but remains maintained for core use cases.

SEE ALSO

rclone(1), curl(1)

Copied to clipboard