How to get WordPress’ version from the CLI

Have you ever been in that situation where you have CLI access to a wordpress site but not through the GUI? I had that experience recently and wanted to know which version of wordpress the person was using. Mainly, I wanted to see if they were keeping things up to date.

So with this handy one liner I found scouring through the web, you can do exactly that.

# find . -name 'version.php' -path '*wp-includes/*' -print -exec grep '$wp_version =' {} \; -exec echo '' \;
./wordpress/wp-includes/version.php
$wp_version = '4.1.1';