How to Set Up WP-CLI and Enable Autocomplete on a cPanel Server

May 24, 2025 / cPanel & WHM

This article covers the steps for installing WP-CLI on a cPanel server, including enabling autocomplete for quicker and more effective command usage.

Before you begin, ensure the following:

  • A server with cPanel installed.
  • SSH access to the server (as a user with sudo/root privileges).

Let us follow the installation Steps:

  1. Start by downloading WP-CLI:
    curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
  2. Change file permissions to enable execution:
    chmod +x wp-cli.phar
  3. Transfer WP-CLI to the Global executables folder:
    mv wp-cli.phar /usr/local/bin/wp
  4. Fetch the WP-CLI Autocomplete script:
    wget https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash
  5. Deploy the Autocomplete Script to the Bash Completion Path:
    mv wp-completion.bash /etc/bash_completion.d/wp-completion.bash
  6. Include the Bash Completion Directory in Jailshell Mounts:
    echo “/etc/bash_completion.d” >> /var/cpanel/jailshell-additional-mounts
  7. Run the Script to Enable Autocomplete:
    echo “source /etc/bash_completion.d/wp-completion.bash” >> /etc/profile.d/wpcli-autocomplete.sh
  8. Test the WP-CLI Autocomplete:
    source /etc/profile.d/wpcli-autocomplete.sh

In such a manner, you can set up WP-CLI and enable Autocomplete on a cPanel Server. For such informative articles, do visit our knowledge base section regularly.

Looking to deploy WordPress using WP-CLI on AlmaLinux? Check out How to install WordPress through WP-CLI on AlmaLinux

Spread the love