Vijayan Thanks for stopping by guys! I'm Vijayan and Techpulse is my beloved brainchild. Currently working as a PHP developer in a digital marketing start-up, I'm overly passionate about not just learning new things but also putting those into practice. I swear by a quote I once came across... 'What separates successful people from unsuccessful people is the former's ability to execute'. Feel free to reach out to me if you have any questions, suggestions or feedback. Hoping to see more of you here!

How to Install WP-CLI on a linux

How to Install WP-CLI on a linux

WP-CLI will be particularly useful if you are a WordPress developer, System Administrator or run a business built on WordPress. WP-CLI is an awesome command line tool for WordPress. It has a lot of commands that can help us installing plugins/themes, add posts, updating WordPress Core, taking backups, querying databases, import/export data quickly and easily. This command line tool will greatly help you do more in less time.

Download WP-CLI

First Connect your server through SSH. recommended to install WP-CLI is by downloading the Phar file. The latest version WP-CLI installation file is available here. You can download by using wget or curl. For Example:

curl -O


Check if it works

Enter the following command to check if it works or not.

php wp-cli.phar --info


Creating executable files

Enter the following command to make it executable.

chmod +x wp-cli.phar



We can move wp-cli.phar file to /usr/local/bin and rename it to wp. This will help us use the WP-CLI commands by just typing ‘wp’ at the start of the commands. Type wp –info to check the status.

sudo mv wp-cli.phar /usr/local/bin/wp


WP-CLI Update

In future, you can update wp cli by entering the following command to update.

sudo wp cli update


For more information about wp-cli installation click here.

wp-cli bash completion

The bash completion feature of WP-CLI allows you to see all the available commands on the fly.

Download the bash script in your home directory

cd ~/

Edit the .bashrc file

Edit the file .bashrc so that it is loaded by the shell every time you log in. Open the file and add the following line in the editor:

source /home/$USER/wp-completion.bash

Run the following command to reload the bash profile

source ~/.bashrc

That’s it. Bash completion is now enabled. To test it, type wp theme (include the trailing space) and press Tab twice. You will see the list of available commands with wp theme again on the prompt.

comments powered by Disqus