WP-CLI manages WordPress from a terminal. Bash completion can suggest commands as you type, reducing typing errors when using it through SSH.

Check existing tools

Run command -v wp and wp --info before installing another copy. Confirm a supported CLI PHP version and the account’s permitted shell access.

Install WP-CLI

Download the official PHAR from the WP-CLI installation guide:

curl -fLO https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Follow that guide’s signature-verification procedure before trusting the download. Check it with the intended PHP interpreter:

php wp-cli.phar --info

For a server-wide installation, an administrator can install the verified file into an unused or deliberately replaced command path:

sudo install -m 0755 wp-cli.phar /usr/local/bin/wp
wp --info

Review an existing /usr/local/bin/wp before replacing it.

Enable Bash completion for your account

Download the official completion script to a private account directory:

mkdir -p "$HOME/.local/share/wp-cli"
curl -fL https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash -o "$HOME/.local/share/wp-cli/wp-completion.bash"

Review the script, then add this line once to your Bash startup file, commonly ~/.bashrc:

source "$HOME/.local/share/wp-cli/wp-completion.bash"

Open a new Bash session and test Tab after a partial WP-CLI command. Completion does not apply to every shell.

Use the site account

Run WordPress commands as the site’s owner, not root. A jailed shell may need provider-supported access to the executable and PHP interpreter; do not add global jail mounts merely to enable completion.