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';
Share this:
<div class="sd-content">
<ul>
<li class="share-facebook">
<a rel="nofollow" data-shared="sharing-facebook-2433" class="share-facebook sd-button share-icon no-text" href="http://usrlocal.com/2015/02/how-to-get-wordpress-version-from-the-cli/?share=facebook" target="_blank" title="Click to share on Facebook"><span></span><span class="sharing-screen-reader-text">Click to share on Facebook (Opens in new window)</span></a>
</li>
<li class="share-linkedin">
<a rel="nofollow" data-shared="sharing-linkedin-2433" class="share-linkedin sd-button share-icon no-text" href="http://usrlocal.com/2015/02/how-to-get-wordpress-version-from-the-cli/?share=linkedin" target="_blank" title="Click to share on LinkedIn"><span></span><span class="sharing-screen-reader-text">Click to share on LinkedIn (Opens in new window)</span></a>
</li>
<li class="share-google-plus-1">
<a rel="nofollow" data-shared="sharing-google-2433" class="share-google-plus-1 sd-button share-icon no-text" href="http://usrlocal.com/2015/02/how-to-get-wordpress-version-from-the-cli/?share=google-plus-1" target="_blank" title="Click to share on Google+"><span></span><span class="sharing-screen-reader-text">Click to share on Google+ (Opens in new window)</span></a>
</li>
<li class="share-pinterest">
<a rel="nofollow" data-shared="sharing-pinterest-2433" class="share-pinterest sd-button share-icon no-text" href="http://usrlocal.com/2015/02/how-to-get-wordpress-version-from-the-cli/?share=pinterest" target="_blank" title="Click to share on Pinterest"><span></span><span class="sharing-screen-reader-text">Click to share on Pinterest (Opens in new window)</span></a>
</li>
<li class="share-twitter">
<a rel="nofollow" data-shared="sharing-twitter-2433" class="share-twitter sd-button share-icon no-text" href="http://usrlocal.com/2015/02/how-to-get-wordpress-version-from-the-cli/?share=twitter" target="_blank" title="Click to share on Twitter"><span></span><span class="sharing-screen-reader-text">Click to share on Twitter (Opens in new window)</span></a>
</li>
<li class="share-email">
<a rel="nofollow" data-shared="" class="share-email sd-button share-icon no-text" href="http://usrlocal.com/2015/02/how-to-get-wordpress-version-from-the-cli/?share=email" target="_blank" title="Click to email this to a friend"><span></span><span class="sharing-screen-reader-text">Click to email this to a friend (Opens in new window)</span></a>
</li>
<li class="share-end">
</li>
</ul>
</div>