Question: How Can I find the WordPress version from command line? Is there any way to get the WP version from the Linux terminal? Answer: Yes, you can find WordPress version from command line with just a simple command.
Why should I need to know the WP version?
Knowing your WordPress version is important to determine if you are safe from latest threads, exploits and issues related to old wordpress versions. You must always keep your wordpress up to date, as well as plugin versions and theme files.
WordPress version can be obtained from a few ways, the most easy way to find wordpress version is to login to the WordPress Admin area, from there you will find if you are running the latest version or if there is an update available.
Find wordpress version from command line
However, if you ever need to find the WordPress version from command line because you don’t have access to the WP Admin Area, you can do it by running a grep command against the version.php file, that is located inside the wp-includes directory.
Try this from your terminal as root:
grep wp_version /home/user/public_html/wp-includes/version.php
Make sure you replace the full path of your WordPress installation with the real data from your system.
The output should look like:
[email@example.com:~]grep wp_version /home/nixcp/public_html/wp-includes/version.php * @global string $wp_version $wp_version = '4.7.2'; [firstname.lastname@example.org:~]
As you see, from the command line we get the same version as from the WP Admin Dashboard.
That’s all. Now you know a good way to find wordpress version from command line, specially useful if you don’t have access to the wp admin dashboard, or you need to get it quickly from the linux terminal.
Do you know other way to get the WP version using the terminal?