0
0
GCPcloud~5 mins

Storage commands (gsutil) in GCP - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the basic command to list all buckets in your Google Cloud Storage using gsutil?
The command is gsutil ls. It lists all buckets in your current project.
Click to reveal answer
beginner
How do you copy a file from your local machine to a Google Cloud Storage bucket using gsutil?
Use gsutil cp [LOCAL_FILE_PATH] gs://[BUCKET_NAME]/. This uploads the file to the bucket.
Click to reveal answer
beginner
What gsutil command removes a file from a bucket?
The command is gsutil rm gs://[BUCKET_NAME]/[FILE_NAME]. It deletes the specified file from the bucket.
Click to reveal answer
intermediate
How can you recursively copy all files from one bucket to another using gsutil?
Use gsutil -m cp -r gs://[SOURCE_BUCKET]/** gs://[DESTINATION_BUCKET]/. The -m flag runs multiple operations in parallel for speed.
Click to reveal answer
intermediate
What does the gsutil rsync command do?
It synchronizes the contents between a local directory and a bucket or between two buckets, copying only changed files to save time and bandwidth.
Click to reveal answer
Which gsutil command lists all files inside a specific bucket?
Agsutil sync gs://bucket-name/
Bgsutil ls gs://bucket-name/
Cgsutil rm gs://bucket-name/
Dgsutil cp gs://bucket-name/
How do you upload a file named 'photo.jpg' to a bucket called 'myphotos'?
Agsutil rm photo.jpg gs://myphotos/
Bgsutil ls photo.jpg gs://myphotos/
Cgsutil mv photo.jpg gs://myphotos/
Dgsutil cp photo.jpg gs://myphotos/
What flag allows gsutil to perform operations in parallel for faster copying?
A-m
B-r
C-p
D-f
Which command deletes a file named 'old.txt' from a bucket 'mybucket'?
Agsutil rm gs://mybucket/old.txt
Bgsutil cp old.txt gs://mybucket/
Cgsutil ls gs://mybucket/old.txt
Dgsutil mv old.txt gs://mybucket/
What is the purpose of the gsutil rsync command?
ATo list files in a bucket
BTo copy a single file
CTo synchronize directories or buckets
DTo delete a bucket
Explain how to upload multiple files from your local folder to a Google Cloud Storage bucket using gsutil.
Think about copying folders and speeding up uploads.
You got /4 concepts.
    Describe the difference between gsutil cp and gsutil rsync commands.
    One is for copying, the other for syncing.
    You got /4 concepts.