Find All WordPress Installations

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.