Skip to content
Go

Google Cloud Storage

Bucket management, IAM, lifecycle policies, and metadata inspection.

10 commandscloudstoragegsutil

Command catalog

Object transferGoogle Cloud Storage

gsutil cp

Copy files between local paths and GCS buckets.

gsutil cp <local_file> gs://<bucket>/<object>
Object transferGoogle Cloud Storage

gsutil rsync

Synchronize directory contents between local storage and buckets.

gsutil -m rsync -r <local_dir> gs://<bucket>/<prefix>
Bucket administrationGoogle Cloud Storage

gsutil mb

gsutil rb

Create or remove buckets in specified regions.

gsutil mb -l <region> gs://<bucket>
Bucket administrationGoogle Cloud Storage

gsutil ls

List buckets or objects with optional filtering.

gsutil ls
Bucket administrationGoogle Cloud Storage

gsutil lifecycle

Configure lifecycle management policies for automatic object transitions.

gsutil lifecycle set lifecycle.json gs://<bucket>
Access controlGoogle Cloud Storage

gsutil iam ch

gsutil iam get

Manage IAM policies for buckets.

gsutil iam ch user:<email>:objectViewer gs://<bucket>
Access controlGoogle Cloud Storage

gsutil acl set

gsutil acl ch

Adjust legacy ACLs for fine-grained object access.

gsutil acl ch -u <email>:READ gs://<bucket>/<object>
Diagnostics and metadataGoogle Cloud Storage

gsutil stat

Retrieve metadata for objects or buckets.

gsutil stat gs://<bucket>/<object>
Diagnostics and metadataGoogle Cloud Storage

gsutil versioning

Enable or disable object versioning on buckets.

gsutil versioning set on gs://<bucket>
Diagnostics and metadataGoogle Cloud Storage

gsutil du

Measure object storage usage per prefix.

gsutil du -sh gs://<bucket>/<prefix>