find -name apache.log # search for a file
find . -name apache.log # search for a file
find . -type f -name apache.log # search for a file
find . -type f -iname apache.log # case insensitive search for a file
find -type d -name snap # search for a directory
find . -type d -name snap # search for a directory
find . -type d -iname snap # case insensitive search for a directory
find . -type f -name '*.txt' # search for txt files
find . -type f -perm 0644 # search for files with 0644 permissions
find . -type f ! -perm 0644 # search for files without 0644 permissions
find . -type f -perm 2644 # search for SGID files wifh 644 permissions
find . -type f -perm 1551 # search for sticky bit files with 551 permissions
find . -type f -perm /u=s # search for SUID files
find . -type f -perm /g=s # search for SGID files
find . -type f -perm /u=r # search for read-only files
find . -type f -perm /a=x # search for executable files
find . -type f -empty # find empty files
find . -type f -name '.*' # find hidden files
find . -type f -user jonas # find files whose owner is jonas
find . -type f -user jonas -name vi # find file vi whose owner is jonas
find . -type f -group jonas # find files whose group is jonas
find . -type f -group jonas -name vi # find file vi whose group is jonas
find . -type f -mtime 10 # find files last modified within 10 days
find . -type f -atime 10 # find files last accessed within 10 days
find . -type f -mtime +3 -mtime -7 # find files last modified 3 and 7 days ago
find . -type f -cmin -10 # find files last changed within last 10 minutes
find . -type f -mmin -10 # find files last modified within last 10 minutes
find . -type f -amin -10 # find files last accessed within last 10 minutes
find . -type f -size 5M # find files whose size is more than 5 MB
find . -type f -size +5M -size -10M # find files whose size is between 5 and 10 MB
find . -size +10M -exec rm -rf {} \; # delete files whose size is greater than 10MB
find . -type f -name *.jpg -size +2M -exec rm {} \; # delete jpg files whose size is greater than 2 MB
find . -maxdepth 1 -type f -mtime +10 # ignoring sub directories find all files last modified more than 10 days ago
find . -type f -exec grep -H 'text-to-find' {} \; # find all files containing text
find . -type f -exec chmod 644 {} \; # recursively set 644 permissions to files
find . -type f -perm 0777 -print -exec chmod 644 {} \; # recursively set 644 permissions to files having 777 permissions
find . -type d -perm 777 -print -exec chmod 755 {} \; # recursively set 755 permissions to directories having 777 permissions
find . -type f -name "vitests.txt" -exec rm -f {} \; # find and delete delete file vitests.txt
find . -type f -name "*.jpg" -exec rm -f {} \; # find and delete all jpg files
find . -type f -exec grep -hrn "string" {} \; # only display line contents containing string