November 2, 2017 · 2 min read
By Alexis Perrier
gsutil is Google Storage CLI tool. Equivalent to aws s3 but for the Google Cloud Platform, it allows you to access Google Cloud Storage from the command line. Beyond moving files and managing buckets, gsutil is a powerful file management (rsync) and file publication tool (signed urls).
Please find below a shortlist of the most important and frequent commands and their relative syntax.
This is a work in progress that will be updated within the next few days.
gsutil is Google Cloud storage CLI. More info on
GCP: Google Cloud PlatformTo get started with gsutil you need python (at least 2.7) and to install the Google Cloud SDK. See https://cloud.google.com/sdk/docs/ to download the right package for your environment.
gsutil ls: lists all your bucketsgsutil help <topic>: help on the topicgsutil mb gs://<bucket_name>: creates the gs://bucket_name1.
gsutil rb gs://<bucket_name>: deletes the bucket.
gsutil cp <filename> gs://<bucket_name>/: copies the local filename into the bucket <bucket_name>.
gsutil cp <filename> gs://<bucket_name>/directory/: copies the local filename into the directory
gsutil mv <src_filename> gs://<bucket_name>/directory/<tgt_filename>: moves the local src_filename to the directory and renames it as tgt_filename
gsutil rm gs://<bucket_name>/file_or_dir: deletes the file_or_dir object.
gsutil cp <filename> gs://<bucket_name>/: copies the local filename into the bucket <bucket_name>.