GCP

gsutil for GCP Cloud Storage

Cloud storage has a separate command line tool named as gsutil which comes under gcloud cli, using gstil command line we would be performing some most used storage commands like creating bucket, listing buckets/objects, copying/moving objects between buckets, managing acls and more.

We can run gsutil command from our Local (gcloud installation required), CloudShell or Server Instance

Prerequisite: Install gcloud on Windows

Below are some frequently used gsutil commands

Create a Bucket

gsutil mb gs://bucket_name

gsutil command to create bucket

List all the bucket

gsutil ls

gsutill command to list buckets

List all objects of a Bucket

gsutill ls gs://bucket_name

Copy objects between Bucket

gsutil cp gs://source_bucket/image.jpg gs://destination_bucket/image.jpg

Download Objects on Local

gsutil cp gs://bucket_name/image.jpg local_path

Upload Objects from Local

gsutil cp image.jpg gs://bucket_name/image.jpg

Rename objects within a Bucket

gsutil mv gs://my_bucket/car.jpg gs://my_bucket/personal_car.jpg

Move objects between Buckets

gsutil mv gs://source_bucket/car.jpg gs://destination_bucket/personal_car.jpg

Apart from the above commands there are many more commands listed on Google official document