Virtual Event
Join us for the next HashiConf Digital October 12-15, 2020 Register for Free

Getting Started

Advanced Shell Configuration

»Command Completion

If you followed the instructions for installing Vault, then you added the vault binary path to your system PATH so that it can be executed as just vault (i.e. without a path prefix). If you did not follow the instructions for installing Vault, review the link and be sure you have Vault properly installed.

The vault binary includes command-line completion for subcommands, flags, and path arguments where supported for the Bash, Fish, or ZSH shell.

Other shells are not currently supported and you will encounter an error when attempting to use an unsupported shell:

Error executing CLI: Did not find any shells to install

Use the vault command to install command-line completions like this.

$ vault -autocomplete-install

The command is expected to return no output upon successful execution.

This installs the helpers in your shell configuration file depending on the type of shell you use:

  • Bash: ~/.bashrc
  • Fish: ~/.config/fish/completions/vault.fish
  • ZSH: ~/.zshrc

Once you have installed the completions, you should restart your terminal session or reload the shell to begin using them.

$ exec $SHELL

Now when you type vault followed by pressing tab, Vault suggests command options:

agent      auth       delete     lease      login      operator   plugin     print      secrets    ssh        token      write
audit      debug      kv         list       namespace  path-help  policy     read       server     status     unwrap

This extends into sub-commands as well; for example, here is what typing vault operator followed by pressing tab suggests as sub-commands:

generate-root  key-status     raft           rotate         step-down
init           migrate        rekey          seal           unseal

These completions are helpful for beginners to discover commands and also handy for advanced Vault users who frequently need to quickly and accurately execute more complex commands.

»Next Steps

If you visited this page from the Install Vault section of the Getting Started guide, then your installation of Vault is complete. Please proceed to Starting the Server to continue getting started with Vault.

»Help and Reference