reference: https://cloud.google.com/sdk/docs/interactive-gcloud
-
Installation and use
The
gcloud
interactive shell is included in thegcloud beta
components.-
To check if you have the
gcloud beta
components installed, run the following command:gcloud components list
-
If you don’t see the
gcloud beta
components listed, to install the beta components, run the following command:gcloud components install beta
-
To enter the
gcloud
interactive mode, run the following command:gcloud beta interactive
Your usual shell prompt is replaced with the
gcloud
interactive shell prompt$
. -
To get auto-suggestions and inline help, start typing a command.
-
To save time when you’re working with a command for a while, type the part of the command you’ll reuse and then press
F7
. For example, to work withgcloud compute
, typegcloud compute
and then pressF7
. You can then type subcommands such aslist
without needing to first typegcloud compute
. When you’re no longer using the command, pressCtrl-C
andF7
to clear the context. -
To exit the interactive shell press
Ctrl-D
orF9
.
Auto-completion and help
gcloud interactive
has auto prompting for commands and flags, and displays inline help snippets in the lower section as you type a command.Static information, like command and sub-command names, and flag names and enumerated flag values, are auto-completed using dropdown menus.
Shortcuts
To accomplish common tasks, you can use the following shortcuts:
Action Shortcut Complete a file path or resource argument Tab
Refine the dropdown completion menu Continue typing the command Scroll through the menu Tab
,Shift+Tab
, or arrow keysSelect a highlighted item or directory Space
or/
Toggle the active help section, ON when enabled, OFF when disabled F2
Set the context for command input to avoid retyping command prefixes F7
Clear the context for command input Ctrl-C
andF7
Open a web browser tab or window to display the complete man page for the current command F8
Exit F9
orCtrl+D
Bash compatibility
bash
completion configs, aliases, exports, functions,set -o
settings, and variables initialized in your.bashrc
are all available at the interactive command prompt. The interactive command line edit mode is derived from theset -o emacs
orset -o vi
setting. -