Google Drive CLI
for cmdhub.
Files, folders, metadata, trash, and sharing permissions from the terminal.
cmdhub get gdrive
data_object Agent Contract
Agents should start with auth/status and discovery commands, inspect schemas before composition, and treat commands marked as mutating as state-changing operations.
Output
Use human output for normal reads, `--json` for scripting or complete structured fields, and `--jsonl` for upstream pipe inputs.
Auth
Google OAuth. Used for Drive files, folders, metadata, trash, and permissions.
Refs
Prefer list/search, then short refs or piped JSONL. Use `resolve` to inspect cached refs.
Schemas
Use `gdrive schema` and `catalog.json` to inspect fields, flags, examples, and side effects.
Auth scopes
openidemailprofilehttps://www.googleapis.com/auth/driveterminal Command Reference
Generated from source. Global flags apply to all commands.
Global Flags
--json
bool
Emit JSON machine output--jsonl
bool
Emit JSONL records for piping--output, -o
string
Compatibility output mode: json|jsonl. Prefer --json or --jsonl--view
string = summary
View mode: summary|full--profile
string = default
Config/auth profile--config
string
Config path override--quiet, -q
bool
Suppress non-essential diagnostics--debug
bool
Enable debug diagnostics--limit
int = 50
Maximum items to emit--page-size
int = 50
Requested upstream page size--cursor
string
Continuation cursor--no-paginate
bool
Fetch only one page--version, -v
bool
Print version informationgdrive auth
Manage Google Drive authenticationgdrive auth login
Authenticate with Google Drivegdrive auth logout
Remove stored credentialsgdrive auth refresh
Refresh stored tokengdrive auth status
Show auth statusgdrive auth whoami
Show current Drive identitygdrive capabilities
Describe capabilities--section
string
Limit output to scopes, schemas, or commandsgdrive config
Inspect local configurationgdrive config explain
Explain resolved configurationgdrive doctor
Run gdrive diagnosticsgdrive file
Manage Drive filesgdrive file delete
Permanently delete a file--all
bool
Confirm batch permanent deletion--file
string
File selector--yes
bool
Confirm permanent deletiongdrive file download
Download file bytes--file
string
File selector--out
string
Output path. Omit to print content.gdrive file export
Export a Google Docs file--file
string
File selector--mime-type
string = text/plain
Export MIME type--out
string
Output path. Omit to print content.gdrive file get
Get file metadata--file
string
File selectorgdrive file list
List files--folder
string
Folder selector--parent
string
Alias for --folder--query
string
Name/full-text query--trashed
bool
Include trashed filesgdrive file search
Search files by name or text--folder
string
Folder selector--parent
string
Alias for --folder--query
string
Name/full-text query--trashed
bool
Include trashed filesgdrive file trash
Move a file to trash--all
bool
Confirm batch trash--file
string
File selectorgdrive file untrash
Restore a file from trash--all
bool
Confirm batch untrash--file
string
File selectorgdrive file update
Update file metadata or parents--add-parent
stringSlice = []
Folder selector to add as parent--description
string
New description--file
string
File selector--name
string
New file name--remove-parent
stringSlice = []
Folder selector to remove as parent--starred
bool
Set starredgdrive file upload
Upload a local file--description
string
File description--folder
string
Parent folder selector--mime-type
string
Content MIME type--name
string
Drive file name--path
string
Local file pathgdrive folder
Manage Drive foldersgdrive folder create
Create a folder--description
string
Folder description--name
string
Folder name--parent
string
Parent folder selectorgdrive folder get
Get folder metadatagdrive folder list
List folders--query
string
Folder name query--trashed
bool
Include trashed foldersgdrive folder search
Search folders by name--query
string
Folder name query--trashed
bool
Include trashed foldersgdrive login
Authenticate with Google Drivegdrive logout
Remove stored credentialsgdrive permission
Manage Drive permissionsgdrive permission add
Add a permission--allow-discovery
bool
Allow public/domain discovery--domain
string
Domain for domain permission--email
string
Email address for user/group permission--file
string
File selector--role
string = reader
Permission role: reader|commenter|writer--type
string
Permission type: user|group|domain|anyone (required)--yes
bool
Confirm creation of a public anyone permissiongdrive permission list
List file permissions--file
string
File selectorgdrive permission remove
Remove a permission--all
bool
Confirm batch permission removal--file
string
File selector--permission
string
Permission selector--yes
bool
Confirm permission removalgdrive profile
Manage provider profilesgdrive profile create
Create an unauthenticated provider profilegdrive profile delete
Delete a local provider profilegdrive profile list
List provider profilesgdrive profile rename
Rename a local provider profilegdrive profile use
Set the default provider profilegdrive resolve
Resolve a local ref, short id, or URL aliasgdrive schema
Emit gdrive schema hints--in
bool
Show input schema--input
bool
Show input schema--out
bool
Show output schemagdrive version
Show gdrive version informationplay_circle Live Examples
Output captured from a real workspace. Regenerate with
scripts/gen-docs.sh --update.
auth
Authenticated as kestrelphilip@gmail.com Profile: kestrelphilip@gmail.com Next steps: - Files: gdrive file list --limit 10 - Folders: gdrive folder list --limit 10 - Capabilities: gdrive capabilities
files
REF NAME STATE UPDATED f1 Google Cloud Free Trial Email.txt active Mon 27 Apr 17:54 f2 test active Fri 24 Apr 19:16 Next steps: - Open: gdrive file get f1 - Search: gdrive file search --query project --limit 10 - Files: gdrive file list --limit 10 - Folders: gdrive folder list --limit 10
No file found. Next steps: - List: gdrive file list --limit 10 - Status: gdrive auth status - Folders: gdrive folder list --limit 10 - Capabilities: gdrive capabilities
folders
REF NAME STATE UPDATED d1 test active Fri 24 Apr 19:16 Next steps: - Open: gdrive folder get d1 - Search: gdrive folder search --query project --limit 10 - Files: gdrive file list --limit 10 - Folders: gdrive folder list --limit 10
alt_route Composition Patterns
Bridge your ecosystem with zero middleware.
# Search for a file, inspect metadata, then list its sharing permissions
gdrive file search --query "project notes" --limit 1 --jsonl \
| gdrive file get
