general windows unix linux debian apache nginx iphone

Unix find command with examples and common usage

All these examples search for files under the location /apps

file size

Find files greater than 1GB

find /apps -size +1024000k -print

Find files greater than 1GB and

find /apps -type f -size +1024000k -exec ls -al {} \;

files last modified

Find files modified less than 7 days back

find /apps -mtime -7 -print

Find files modified longer than 7 days ago

find /apps -mtime +7 -print

file permissions

Find files that are executable

find /apps -perm -100 -print

Find files that have permissions -r--r--r--

find /apps -perm 444 -print

Find directories that have write permissions

find /apps -type -perm 777 -print

files with extensions

Search for *.log files under /apps

find /apps -name '*.log' -print

files by type

Search for softlinks

find /apps -type l -print | xargs ls -l

using xargs

Find files with executive permission and remove the x permission for groups and others

find /apps -perm -20 -exec chmod go-x {} ;

You can also use this:

find /apps -perm -20 -print | xargs chmod go-x

Last Update: 2 September 2009