Linux find command – some examples

The Linux find command can be very powerful and very handy, here are some examples that I try to remember or at least have handy so that I don’t have to go into the MAN pages or Google!

Find all JPG image files on the system:

 find / -name *.jpg 

 or you can grep results as well

 find / | grep .jpg 

Find all the directories named “conf” on the system:

 find / -type d -name conf 

Find all the files owned by user Cathy:

 find / -user cathy 

To find files owned by a group named engineering

 find / -group engineering 

Find all the files that were changed in the last 10 minutes:

 find / -mmin -10 -type f 

 or to find files changed in the last 10 days

find / -mtime -10 

Find files with certain permissions applied. Hopefully you don’t find any 777 files in your web server area!:

 find /var/www -perm 777 

Find large files on the system with a few different options. This command shows the 5 largest files in the sharedata folder and lists them in order from largest to smallest.:

  find /shareddata/ -type f -exec du -h {} ; | sort -rh | head -5 

Reference: MAN find or find –help

Bookmark the permalink.