gcloud
gcloud 480+Quick reference for gcloud (Google Cloud CLI), gsutil, and bq commands: authentication, project / IAM, Compute / GKE / BigQuery / Cloud Storage, config, and Cloud Build / Deploy — with common options and practical examples.
48 commands
Help
gcloud --versionPrint versions of gcloud, gsutil, bq, and the core libraries.
gcloud --versiongcloud helpShow top-level help with the full list of command groups.
gcloud helpgcloud help <cmd>Show flags + examples for any gcloud command (path separators are spaces).
gcloud help compute instances creategcloud topic <topic>Read in-depth docs: `configurations`, `projections`, `filters`, `offline`, etc.
configurations; projections; filters; offline; access-control
gcloud topic filtersAuthentication
gcloud initFirst-run wizard — login, pick a project, pick a default region / zone.
gcloud initgcloud auth loginAuthorize gcloud to access GCP with your user credentials (browser OAuth flow).
--no-launch-browser; --no-activate
gcloud auth login --no-launch-browsergcloud auth application-default loginSet up Application Default Credentials — picked up by client libraries (Python / Node / Go).
--scopes <scope1,scope2>; --no-launch-browser
gcloud auth application-default logingcloud auth activate-service-account --key-file <key.json>Activate a service account using a downloaded JSON key file.
gcloud auth activate-service-account [email protected] --key-file=ci.jsongcloud auth listList every credentialed account.
--format=yaml; --filter
gcloud auth listgcloud auth revokeRevoke credentials for one account or all.
<account>; --all
gcloud auth revoke --allProject
gcloud config get-value projectPrint the currently active project.
gcloud config get-value projectgcloud config set project <id>Set the active project.
gcloud config set project my-gcp-projectgcloud projects listList every project you have access to.
--format='table(projectId,name,projectNumber)'; --limit
gcloud projects list --format='table(projectId,name)'Configuration
gcloud config configurations listList every saved configuration (named profile).
--format=yaml
gcloud config configurations listgcloud config configurations create <name>Create a new named configuration.
--no-activate
gcloud config configurations create dev --no-activategcloud config configurations activate <name>Switch to an existing configuration.
gcloud config configurations activate prodCLOUDSDK_ACTIVE_CONFIG_NAME=<name> gcloud ... Use a configuration without modifying the persistent one (CI / scripts).
CLOUDSDK_ACTIVE_CONFIG_NAME=prod gcloud compute instances listgcloud config set compute/region <region>Set a per-property default (region / zone / project / account).
compute/region; compute/zone; container/cluster; compute/region us-central1
gcloud config set compute/region us-central1Output
gcloud <cmd> --format=<fmt>Choose output format: `json`, `yaml`, `table`, `csv`, `value`, `default`.
json; yaml; table; csv; value; default; get(<expr>):label
gcloud compute instances list --format='table(name,zone.basename(),machineType.basename())'gcloud <cmd> --filter='<expr>'Server-side filter — see `gcloud topic filters` for the expression syntax.
name=foo; zone:us-*; status:RUNNING
gcloud compute instances list --filter='zone:us-central1-a AND labels.env=prod'gcloud <cmd> --limit <N>Cap the result count (server-side pagination is unlimited otherwise).
gcloud compute instances list --limit=20IAM
gcloud iam service-accounts listList every service account in the active project.
--project; --format=json; --limit
gcloud iam service-accounts listgcloud iam service-accounts keys create <file.json> --iam-account <sa>Create a JSON key for a service account — needed by tools that don't support ADC.
--iam-account <sa>; --key-file-type json
gcloud iam service-accounts keys create ci.json --iam-account [email protected]gcloud projects add-iam-policy-binding <project> --member='user:<email>' --role='roles/<role>'Grant a role to a member at the project level.
--member=user:foo@bar / serviceAccount:foo / group:bar / domain:bar; --role=roles/owner
gcloud projects add-iam-policy-binding my-proj --member='user:[email protected]' --role='roles/viewer'Compute Engine
gcloud compute instances listList every VM with zone, machine type, and status.
--project; --filter; --format=table; --limit
gcloud compute instances list --format='table(name,zone,machineType,status)'gcloud compute instances create <name> --zone <z> --machine-type <t>Create a VM with default image (Debian 12).
--zone; --machine-type; --image-family; --image-project; --preemptible; --tags; --labels; --metadata; --service-account; --scopes
gcloud compute instances create vm-dev --zone=us-central1-a --machine-type=e2-medium --image-family=debian-12gcloud compute ssh <vm> --zone <z>Open an SSH session to a VM (auto-generates / persists keys under `~/.ssh/google_compute_engine`).
--zone; --ssh-key-file; --command <cmd>; --tunnel-through-iap; --internal-ip
gcloud compute ssh vm-dev --zone=us-central1-a --command 'docker ps'gcloud compute instances delete <vm> --zone <z>Delete a VM (with or without disks).
--zone; --delete-disks=all / data / boot
gcloud compute instances delete vm-dev --zone=us-central1-a --delete-disks=allgcloud compute disks listList every persistent disk.
--filter='zone:us-*'; --format=table
gcloud compute disks list --format='table(name,sizeGb,zone,status)'gcloud compute snapshots create <name> --source-disk <disk>Snapshot a persistent disk for backups or cloning.
--source-disk <name>; --source-disk-zone; --description
gcloud compute snapshots create snap-2026-08-25 --source-disk=data-disk --source-disk-zone=us-central1-aGKE
gcloud container clusters listList every GKE cluster.
--region; --format=table; --limit
gcloud container clusters list --format='table(name,zone,masterVersion,status)'gcloud container clusters get-credentials <name> --region <r>Merge the cluster's kubeconfig into `~/.kube/config` and switch context.
--region; --zone; --project; --internal-ip
gcloud container clusters get-credentials my-cluster --region=us-central1gcloud container clusters create <name> --num-nodes=1Create an Autopilot or Standard GKE cluster.
--num-nodes; --machine-type; --region; --enable-autoscaling; --enable-autorepair; --cluster-version; --release-channel rapid|regular|stable
gcloud container clusters create my-cluster --region=us-central1 --num-nodes=3 --enable-autoscaling --min-nodes=1 --max-nodes=5Cloud Storage
gsutil lsList buckets / objects (alias: `gcloud storage ls`).
-r; -l; -h; gs://; -d (list dirs only)
gsutil ls gs://my-bucket/data/gsutil cp <local> gs://<bucket>/<key>Upload or copy an object. `-r` for recursive directory copy.
-r; -m parallel; -c preserve cache-control; -p preserve ACL; -n no-clobber; -z <fmt> compress on upload
gsutil cp -r ./dist gs://my-bucket/app/gsutil rsync -r <src> <dst>Two-way directory sync (parallel, fast). Source / destination can be local or `gs://`.
-r; -d delete extras; -c checksum-compare; -n dry-run; -x exclude
gsutil rsync -r -d ./build gs://my-bucket/buildgcloud storage buckets create gs://<name> --location <loc>Create a new Cloud Storage bucket with the specified location / class.
--location; --default-storage-class; --uniform-bucket-level-access; --public-access-prevention
gcloud storage buckets create gs://my-bucket --location=us-central1 --uniform-bucket-level-accessBigQuery
bq query --use_legacy_sql=false 'SELECT ...'Run an ad-hoc SQL query against BigQuery.
--use_legacy_sql=false; --max_rows; --destination_table; --parameter; --format=json
bq query --use_legacy_sql=false 'SELECT COUNT(*) FROM `bigquery-public-data.samples.shakespeare`'bq show --format=pretty <project>:<dataset>Show metadata about a project / dataset / table / job.
--format=pretty; --schema; --view
bq show my-proj:my_datasetbq load --source_format=CSV --autodetect <dataset>.<table> <file>Bulk-load a local CSV/JSON/Parquet file into a BigQuery table.
--source_format=CSV|JSON|PARQUET|AVRO|NEWLINE_DELIMITED_JSON; --autodetect; --replace; --skip_leading_rows=1
bq load --source_format=CSV --autodetect --skip_leading_rows=1 my_dataset.users users.csvCloud Build
gcloud builds submit --tag gcr.io/<proj>/<img>Build a container from the current directory using the default Cloud Build config.
--tag; --config <file>; --machine-type; --timeout; --gcs-source-staging-dir; --no-source-image-upload
gcloud builds submit --tag gcr.io/my-proj/app:v1 .Cloud Deploy
gcloud app deploy <yaml>Deploy to App Engine standard / flex.
--image-url; --version; --promote; --stop-previous-version
gcloud app deploy app.yaml --promotePub/Sub
gcloud pubsub topics publish <topic> --message '<msg>'Publish a single message — useful for ad-hoc testing.
--message; --attributes; --ordering-key
gcloud pubsub topics publish my-topic --message 'hello' --attributes=k=vgcloud pubsub subscriptions pull <sub> --limit <N> --auto-ackPull (and auto-ack) N messages from a subscription — great for sanity checks.
--limit; --auto-ack; --format=json
gcloud pubsub subscriptions pull my-sub --limit=5 --auto-ackDeploy / rollback
gcloud components updateUpdate gcloud itself + every installed component to the latest release.
gcloud components updategcloud components install <name>Install an optional gcloud component (kubectl, bq, gsutil, app-engine-python, ...).
<name>
gcloud components install kubectlDiagnose
gcloud infoPrint the gcloud environment: python version, install location, active config.
--run-diagnostics; --log-level=debug
gcloud infogcloud feedbackOpen a browser to the public gcloud issue tracker with environment info pre-filled.
--log-level=debug
gcloud feedbackRelated command cheatsheets
aws cli
Quick reference for the AWS Command Line Interface: configure credentials, IAM identity, EC2 / Lambda / S3 / DynamoDB / IAM, profiles, SSO, and pagination / output formatting — with common options and practical examples.
40 commands
AWS CLI v2
azure cli
Quick reference for the Azure CLI (az): authentication, subscription / resource management, VM / AKS / Storage / App Service / Key Vault, query formatting, and CI-friendly workflows — with common options and practical examples.
43 commands
Azure CLI 2.60+
kubectl
Quick reference for kubectl, the Kubernetes command-line client: contexts, get/describe, apply, logs/exec, rollout, scaling and debugging — with common options and practical examples.
40 commands
kubectl 1.28+
docker
Quick reference for everyday Docker CLI commands: container lifecycle, image builds, logs / exec, networking, volumes, Compose, registry and housekeeping — with common options and practical examples.
46 commands
Docker Engine 24.0+
Trademark & Use Notice
These command-line tool cheatsheets are open community references. The names, logos, and trademarks of the tools referenced here (such as Git™, Docker™, Kubernetes®, kubectl, PostgreSQL®, MySQL®, Redis™, MongoDB®, Linux™, PowerShell™, Vim™, and others) are the property of their respective owners and are used here solely for identification and reference purposes.
All content in these cheatsheets is independently authored as a simplified, self-contained reference. It is not affiliated with, endorsed by, or sourced from any official documentation. Command listings, flag descriptions, and examples are original simplifications; for authoritative information please consult the official documentation of each tool.
Command syntax and option flags may differ across tool versions. The version tags shown reflect stable releases; behavior may differ in other versions. This cheatsheet does not imply any preference or recommendation by the trademark holders.
If a trademark or copyright owner believes that any content on this site infringes their rights, please send an email to [email protected]. Upon receiving valid proof of rights, we will modify or remove the relevant content within a reasonable period.
This website assumes no legal liability for any direct or indirect losses arising from the use of information presented on these pages.
About Google Cloud CLI
The Google Cloud CLI (gcloud) is Google's official command-line tool for managing Google Cloud Platform (GCP) services. It bundles three binaries in one installer: `gcloud` (resource management, IAM, App Engine, Cloud SQL, GKE, Compute Engine), `gsutil` (Cloud Storage, originally from the older `gsutil` standalone CLI), and `bq` (BigQuery). The current stable line is gcloud 480+ (Aug 2025 era). gcloud follows the resource-group pattern: `gcloud <group> <resource> <verb>` — e.g. `gcloud compute instances list`, `gcloud iam service-accounts keys create`. Authentication supports interactive `gcloud auth login`, service-account keys, and Application Default Credentials (ADC) via `gcloud auth application-default login` — the latter being the canonical credential source for Terraform, Python, and Node.js SDKs. gcloud is Apache 2.0 licensed and never uploads your code anywhere except via explicit `gcloud app deploy`, `gcloud builds submit`, etc.
Cheatsheet version 1.0.0