How to Install WP-CLI On a Linux Server?

By on August 17th, 2018

How to Install WP-CLI On a Linux Server?

It is very important to keep your WordPress installations, plugins and themes up-to-date. For this process, we can use WP-CLI. WP-CLI is a command line interface for WordPress. You can update plugins, configure multisite install and much more without using the WordPress dashboard. WP-CLI provides a set of command line tools for upgrading the WordPress core files. Using WP-CLI you can keep your WordPress website up to date and keep your server safe and clean from malicious files. In this tutorial let’s have a look into how we can install and use WP-CLI.

1) Login your server via SSH as root.

# ssh root@your server IP address

2) Enter into the directory /opt

# cd /opt

3) Now download the wp-cli file

# wget

4)  You can verify whether the file works or not by executing the following command.

# php wp-cli.phar –info

5) Make the downloaded file executable.

# chmod +x wp-cli.phar

6) Move it to the directory “/usr/local/bin/” on your server. If you want you can rename the downloaded to something simpler, so you can execute it easily at every time you wish to.

# mv wp-cli.phar /usr/local/bin/wordpress

7) After making the file executable and moving into the above-mentioned directory, you are able to run the WP-CLI. For this, you have to navigate to the WordPress installed directory on your server.

# cd /wordpressinstalleddirectory/

8) To check the version of the WordPress installation on your server execute the following command.

# wordpress core version

9) To update the WordPress installation on your server, execute the following command.

# wordpress core update

10) If you want to update the themes you can execute the following.

# wordpress theme update –all

11) To update all the plugins, you have to execute the following.

# wordpress plugin update –all

Likewise, you can update a single plugin too using after the plugin enters the preferred plugin name in the above command.

12) Similarly, you can install/uninstall a plugin using WP-CLI.

# wordpress plugin install “pluginname”

Replace the plugin name with the preferred plugin name you wish to update.

13) To activate a plugin, execute the below-mentioned command.

# wordpress plugin activate “pluginname”

Similarly, you can deactivate a plugin too.

14) To list all the installed plugins execute the following.

 # wordpress plugin list

You can get more information about WP-CLI by running the command below.

# wordpress –help

Hence we have learned how to install and use WP-CLI on your Linux server.


If you need any further assistance please contact our support department.



Leave a Reply