WP-CLI is command line tool specifically made for WordPress (WP) which provides a command-line interface (CLI) for many actions you might perform to manage your WordPress sites.
For example, you can install, activate or update plugins,configure multisite installs and do many things you can’t do in the WordPress admin like deleting transients, database search and replace etc.
To install WP-CLI first make sure your environment meets the minimum requirements:
PHP 5.3.29 or later
WordPress 3.7 or later
UNIX-like environment (OS X, Linux, FreeBSD, Cygwin)
1. Download latest version of WP-CLI
Once you’ve verified requirements, you can install the latest version of WP-CLI using “curl” or “wget” command. Installation file and the latest version of WP-CLI can be found at:
Using cURL to download the file, type:
If not already installed you can install cURL on Debian/Ubuntu distributions with
sudo apt-get install curl
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
2. Check that it’s working
Check downloaded file to verify that it’s working:
php wp-cli.phar --info
3. Make it executable
Change the permission of the file to be executable using command “chmod”. Type the following command:
chmod +x wp-cli.phar
4. Optionally, set to use as a global command
If you want to use WP-CLI from the command line typing up “wp” (or any name you prefer) move file to /usr/local/bin directory. Directory /usr/local/bin is for programs that a normal user may run and usually is default location for executable programs not part of the operating system.
sudo mv wp-cli.phar /usr/local/bin/wp
If WP-CLI was installed successfully, you should see something like this when you run “wp –info”:
OS: Linux 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 Shell: /bin/bash PHP binary: /usr/bin/php7.2 PHP version: 7.2.3-1+0~20180306120016.19+stretch~1.gbp81bf3b php.ini used: /etc/php/7.2/cli/php.ini WP-CLI root dir: phar://wp-cli.phar WP-CLI vendor dir: phar://wp-cli.phar/vendor WP_CLI phar path: /var/www WP-CLI packages dir: WP-CLI global config: WP-CLI project config: WP-CLI version: 1.5.0