These days there are often WordPress apps on the control panel of hosting providers that enable you to install WordPress easily with a click. You can install and run WordPress entirely by FTP/SFTP and the admin dashboard, but this can be slow. However, if you are comfortable with the Linux command line, you can install WordPress, themes, and plugins at a lightning fast speed. This is particularly useful if you are moving from one hosting company to another and you have more than one WordPress blog to move at the same time.
Sometimes SFTPing to a host can be very slow. WordPress is made up of so many individual files that uploading everything when installing or updating can take a very long time.
This method is very quick and snappy way to download the latest version of WordPress when you are initially installing your blog…
wget http://wordpress.org/latest.tar.gztar xfz latest.tar.gz
These commands install WP-CLI…
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.pharchmod +x wp-cli.pharsudo mv wp-cli.phar /usr/local/bin/wp
You can do this from anywhere because the three lines are 1) download, 2) change permissions and 3) move.
If you install WP-CLI before installing WordPress you can even install WordPress with WP-CLI, see wp core install…
wp core download --locale=nl_NLwp core install --url=example.com --title=Example --admin_user=supervisor --admin_password=strongpassword --admin_email=[email protected]wp core version
The 3 lines are 1) download, 2) install and 3) check the version of WordPress that is installed.
Assuming you have already set up the WordPress blog (wp-config.php and database), you can then install and activate multiple plugins very easily like this…
wp plugin install wordpress-seo jetpack post-volume-stats add-target-fixer --activate
Another use might be that you can easily de-activate plugins if you ever have problems logging in…
wp plugin deactivate plugin-name
One thing that you cannot do with SFTP and the WordPress admin dashboard is a sitewide search and replace. There are probably plugins that will help you do this, but it is made very easy with WP-CLI…
wp search-replace oldstring newstring
The --dry-run
flag also helps you to see what you’re about to change before you change it.
Perhaps the most useful function of WP-CLI for me is the ability to update WordPress very easily and quickly. This is all it takes…
wp core update
For more info see the docs at WP-CLI.
Quick Links
Legal Stuff