The gcloud interactive shell provides a richer bash
experience, simplifying
command and documentation discovery with as-you-type autocompletion and
help text snippets.
It produces suggestions and auto-completion for gcloud
, bq
, gsutil
,
and kubectl
command-line tools, and any command that has a man(1) page.
Sub-commands, flags, and file and resource arguments are completed, along with
inline help, as the command is composed.
Installation and use
Check if you have the
gcloud beta
components installed:gcloud components list
To install the beta components:
gcloud components install beta
Enter the
gcloud interactive
mode:gcloud beta interactive
Your usual shell prompt will be replaced with the gcloud interactive shell prompt
$
.To exit the interactive shell type
exit
,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 the command is typed.
Static information, like command and sub-command names, and flag names and
enumerated flag values, are auto-completed using dropdown menus. Hit tab
to
complete file path and resource arguments.
Type the next character to refine the dropdown completion menu, or use tab
to scroll through the menu. Finally, use space
or /
to select the
highlighted item or directory.
Shortcuts
To accomplish common tasks, function keys can be used to toggle mode/state settings or run specific actions.
F2:help:STATE
Toggles the active help section, ON when enabled, OFF when disabled.F7:context
Sets the context for command input, so you won't have to re-type common command prefixes at every prompt. The context is the command line from just after the prompt up to the cursor. For example, if you are about to work withgcloud compute
for a while, typegcloud compute
and hitF7
. Hitctrl-c
andF7
to clear the context.F8:web help
Opens a web browser tab/window to display the complete man page help for the current command. Command specific help or man(1) help is attempted, if the web browser is not available.F9:quit
Exit. You can also run theexit
command or hitctrl-d
to exit.
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 the set -o emacs
or set -o vi
setting.
More information
For greater detail about the interactive shell and its shortcuts, control characters, editor modes, and configurable layout options, consult the gcloud beta interactive reference page.