find – Linux Command

Find a a useful Linux command that can be used to search for files.

Search files by file name

To find all files in current directory with extension .png, run

find ./ -name "*.png"

Find Files larger than X MB

To find all files larger than 10 MB size, run

find /var -type f -size +10M -exec ls -lh {} \;

Finding WordPress Versions in a Server

To find all wordpres installation on a server and its version, run

find /home/*/public_html/ -type f -iwholename "*/wp-includes/version.php" -exec grep -H "\$wp_version =" {} \;

To find all sites using vShare Youtube clone script, run

find /home/*/public_html/ -type f -iwholename "*/include/vshare.php" -exec grep -H "vshare_version = " {} \;

Example

root@server74 [~]# find /home/*/public_html/ -type f -iwholename "*/include/vshare.php" -exec grep -H "vshare_version = " {} \;
/home/beardsty/public_html/include/vshare.php:$vshare_version = '2.9';
/home/clipmlip/public_html/backup-2.7/include/vshare.php:$vshare_version = '2.7';
/home/clipmlip/public_html/include/vshare.php:$vshare_version = '2.8.1';
/home/ftmtube/public_html/include/vshare.php:$vshare_version = '2.9';
/home/gostrongm/public_html/include/vshare.php:$vshare_version = '2.9';
/home/intoxica/public_html/include/vshare.php:$vshare_version = '2.9';
/home/mushin01/public_html/backup/include/vshare.php:$vshare_version = '2.7';
/home/mushin01/public_html/include/vshare.php:$vshare_version = '2.9';
/home/tobzacda/public_html/include/vshare.php:$vshare_version = '2.9';
/home/videoctn/public_html/include/vshare.php:$vshare_version = '2.7';
/home/videoctn/public_html/vshare2.7/include/vshare.php:$vshare_version = '2.7';
root@server74 [~]# 

Posted in Linux