$linuxjunkies
>

gcloud(1)

Google Cloud command-line interface for managing Google Cloud resources and services.

UbuntuDebianFedoraArch

Synopsis

gcloud [GLOBAL_OPTIONS] COMMAND [COMMAND_OPTIONS] [ARGUMENTS]

Description

gcloud is the primary command-line tool for interacting with Google Cloud Platform (GCP). It provides a unified interface to manage compute instances, storage, databases, networking, and hundreds of other cloud services from the terminal.

Before using gcloud, authenticate with your Google Cloud account using gcloud auth login and set your active project with gcloud config set project PROJECT_ID. Configuration is stored locally and persists across sessions.

Commands are organized hierarchically: gcloud compute instances list manages Compute Engine VMs, gcloud storage buckets manages Cloud Storage, and so on. Use gcloud COMMAND --help for detailed documentation on any command.

Common options

FlagWhat it does
--project PROJECT_IDSet the GCP project for this command (overrides configuration)
--region REGIONSet the compute region (e.g., us-central1, europe-west1)
--zone ZONESet the compute zone (e.g., us-central1-a, europe-west1-b)
--quiet, -qSkip interactive prompts and assume default answers
--verbosity LEVELControl output verbosity (debug, info, warning, error, critical)
--format FORMATOutput format: json, yaml, table, csv, or custom
--help, -hDisplay help for the command
--impersonate-service-account SA_EMAILExecute command as a service account
--configuration CONFIG_NAMEUse a specific named configuration

Examples

Authenticate with your Google Cloud account and set up credentials

gcloud auth login

Set the default project for all subsequent gcloud commands

gcloud config set project my-project-id

List all Compute Engine VM instances in the us-central1-a zone

gcloud compute instances list --zone=us-central1-a

List all Cloud Storage buckets and output as JSON

gcloud storage buckets list --format=json

Create a new Compute Engine instance with a specific machine type

gcloud compute instances create my-vm --zone=us-central1-a --machine-type=e2-medium

SSH into a Compute Engine instance with automatic credential setup

gcloud compute ssh my-vm --zone=us-central1-a

Display the current gcloud configuration and properties

gcloud config list

Delete a VM instance without confirmation prompts

gcloud compute instances delete my-vm --zone=us-central1-a --quiet

Related commands