The Pulumi CLI also has a command to generate a command-line completion script for Bash, Zsh, and Fish. This gives you tab completion for all commands,
sub-commands, and flags, which can make it easier to remember what to type and where.
### Bash
To use this, you'll first need to ensure bash completion is installed:
* On most current Linux distros, bash completion should be available.
* On a Mac, install with `brew install bash-completion`.
The `pulumi gen-completion bash` command self-generates its own CLI script. You can save the output to a file.
* On Linux, save to `pulumi gen-completion bash > /etc/bash_completion.d/pulumi`.
* On macOS, save to `pulumi gen-completion bash > /usr/local/etc/bash_completion.d/pulumi`.
Ensure that bash completion is run when you launch a new terminal by adding it to `~/.bash_profile`.
On Linux:
```
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
```
On macOS:
```
if [ -f /usr/local/etc/bash_completion ]; then
. /usr/local/etc/bash_completion
fi
```
Finally, after saving the `pulumi` bash completion script, either reopen your terminal or source your profile
in order to reload the bash completion scripts in your current terminal session (`. ~/.bash_profile`).
### Zsh
The `pulumi gen-completion zsh` command self-generates its own CLI script. You can save the output to a file inside a directory listed in the `$fpath` variable.
You can list your `$fpath` directories and pick one of them:
```shell
echo $fpath
```
You can also use an arbitrary directory like `~/.zsh/completion/` and then add it to your `fpath` in `~/.zshrc` :