Using FIND to search better

Basic Use of FIND

If you are looking to find a file, one of the commonest tools is used Find. Here is a recap.

S/NoFile TypeDescription
1type -fLimits search results to files only
2type -dLimits search results to directories only
3type -l Limits search results to symbolic links only

For example, search for a case-insensitive file named “”

find $HOME -type -iname ""
1-namePerform a case-sensitive search for “files”
2-iname Perform a case-insensitive search for “files”
3size +nMatches files of size larger than size n
4size -nMatches files of size smaller than size n
5-mtime nMatches files or directories whose contents were last modified n*24 hours ago
6-atime nMatches files last access n*24 hours ago

For example, search for all case-insensitive files with the extension *mov 2 days ago

find $HOME -type -iname "*.mov" -mtime 2
1-andMatch for both sides of the operators
2-orMatch for either test of the operators
3-noteDon’t match the test of the operators

For example, search for all files with Hello*, but excl ude pdf and jpg

find \( -name "Hello*" -mtime 2 \) -and -not \( -iname "*.jpg" -or -iname "*.pdf" \)
When using the () to combine tests, remember to escape the (\) brackets. You will need to leave a space after you open and close the brackets

Using FIND and EXEC

find -type f -iname "*.mov" -exec chmod +x {} \;

The first part find -type f -iname”*.mov” will not be explained….. Executed commands must end with \; (a backslash and semi-colon) and may use {} (curly braces) as a placeholder for each file that the find command locates.


  1. Linux Format – March Edition
  2. Use the Unix find command to search for files

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s