gcloud tool offers many configuration properties and global flags to customize user experience and modify behavior
Global flags
Description
–quiet
Disable prompts
–log-http
Record all network requests & responses
–verbosity <LEVEL>
one of critical, debug, error, info, warningg none
–format
Modify the output format for the command
–flatten
Modifies the command outputt by separiting nested lists into distinct elements
List-Specific tags
Description
–filter <Expression>
Filter list results based on given expression
–limit <LIMIT>
Limit number of results
–sort-by [FIELD, ..]
One or more fields to sort results by
Lets use some of the expressions
gcloud services list --available
gcloud services list --available --format="json"
gcloud services list --format="table[box, title= 'Services List'](name, state)"
Some other formats
gcloud compute zones list --format="csv(name,region)"
gcloud compute networks subnets list --network=default --filter="region:(us-west1 us-central1)" --format=json
gcloud compute networks subnets list --format="json" --filter="name=default AND region ~ us-central1"
Sample Shell Script to iterate through vm instances