lots of tech info here

Unix find command with examples and common usage

All these examples search for files under the location /apps

file name and strings

search for files named server.properties

  find /apps -name server.properties

search for string "JAVA_HOME" in all files

  find /apps -exec grep "JAVA_HOME" '{}' /dev/null \; -print

search for files by user USER123

  find . -user USER123

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

Updated on 01 Sep 2009 {Created on 02 Sep 2009}

If you liked this article, follow us on Facebook and Twitter (@aruljohn).

Share this with Others