I was trying to figure out how many WordPress installations lived on one of my hosting servers recently, and I also wanted to see how good the site owners are at keeping them up-to-date, which means I also wanted to find out the WordPress version number of each installation.
I couldn’t find any quick way of doing this so I turned the linux find command and grep to give me a hand. Here is the command (which must be run as a privileged user):
find /var/www/vhosts -type d -name "wp-includes" -print -exec grep "wp_version" {}/version.php \;
Just replace /var/www/vhosts with the root directory of where all of your domains are stored. Hope this helps someone. Cheers.
Updated: I switched the above command to use “-type d” vs “-d” as per James’ comment below. Thanks James.
Thanks for the tip Matt!
However in my case, I had to use “-type d” instead of “-d” for the find command:
find /var/www/vhosts -type d -name “wp-includes” -print -exec grep “wp_version” {}/version.php \;
-d seems to be a depth parameter, whereas in your case you’re searching for any directories called “wp-includes”.
James
Thanks James! Oh yes the -type switch, thanks for pointing that out I’ve updated the post reflect this. Cheers. -Matt