Hello, friends. In this post, you will learn how to install WP-CLI on Ubuntu 22.04. We will also take a look at some of its most basic functions.
What is WP-CLI?
According to the tool’s website:
WP-CLI is the command-line interface for WordPress. You can update plugins, configure multisite installations and much more, without using a web browser.
Thanks to this tool, it is possible to manage many things on WordPress in a faster and more direct way.
WP-CLI provides a command-line interface for many actions you might perform in the WordPress admin. So, it is an important help for WordPress sysadmin.
WP-CLI is a cross-platform application because it has versions for Windows, Linux, and macOS, so we will have no problems using it. In addition, it is open source, so you can study it searching for bugs or for learning.
Let’s go.
Install WP-CLI on Ubuntu 22.04
One of the requirements to install WP-CLI is to have WordPress installed, as it is obvious. Therefore, this is assumed.
To download the tool, just run
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
When you download it, you will be able to give it execution permissions
chmod +x wp-cli.phar
And then copy it to a location inside your path with a simpler name like wp
.
sudo mv wp-cli.phar /usr/local/bin/wp
Finally, you can check everything with the command
wp --info
So, you are ready.
Some interesting commands
Some interesting WP-CLI commands allow us to do effortless tasks with WordPress.
One of the most common is to install a plugin
wp plugin install [path-zip-file | URL]
Or even list them
wp plugin list
Essential in some occasions is to deactivate all the plugins in the instance
wp plugin deactivate --all
You can also choose one plugin to deactivate
wp plugin update [plugin_name]
Or update all of them
wp plugin update --all
Finally, you can consult all possible help with the command
wp help
Conclusion
WP-CLi is a simple tool, but it helps a lot with WordPress administration. So, it is essential to use it and have it at hand for anything.