gcloud interactive shell provides a richer
bash experience, simplifying
command and documentation discovery with as-you-type autocompletion and
help text snippets.
gcloud interactive shell produces suggestions and auto-completion for any
command that has a manual (man) page, including the
kubectl command-line tools. As you type a command, sub-commands, flags,
and file and resource arguments are completed and inline help is displayed in
the lower section.
For more information about the interactive shell and its shortcuts, control
characters, editor modes, and configurable layout options, see the
gcloud beta interactive
Installation and use
gcloud interactive shell is included in the
gcloud beta components.
To check if you have the
gcloud betacomponents installed, run the following command:
gcloud components list
If you don't see the
gcloud betacomponents listed, to install the beta components, run the following command:
gcloud components install beta
To enter the
gcloudinteractive mode, run the following command:
gcloud beta interactive
Your usual shell prompt is replaced with the
gcloudinteractive 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 with
gcloud compute, type
gcloud computeand then press
F7. You can then type subcommands such as
listwithout needing to first type
gcloud compute. When you're no longer using the command, press
F7to clear the context.
To exit the interactive shell press
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.
To accomplish common tasks, you can use the following shortcuts:
|Complete a file path or resource argument||
|Refine the dropdown completion menu||Continue typing the command|
|Scroll through the menu||
|Select a highlighted item or directory||
|Toggle the active help section, ON when enabled, OFF when disabled||
|Set the context for command input to avoid retyping command prefixes||
|Clear the context for command input||
|Open a web browser tab or window to display the complete man page for the current command||
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
set -o emacs or
set -o vi setting.