Difference between revisions 507991 and 507992 on knwiki

{{other uses}}
{{lowercase|title=find}} 
In [[Unix-like]] and some other [[operating system]]s, <code>'''find'''</code> is a [[command-line utility]] that [[Search engine (computing)|searches]] through one or more [[directory tree]]s of a [[file system]], locates [[Computer file|file]]s based on some [[user (computing)|user]]-specified criteria and applies a user-specified action on each matched file. The possible search criteria include a [[pattern matching|pattern(contracted; show full)

This command will search in the /usr/src directory and all sub directories. All files that are of the form '*,v' and '.*,v' are excluded. Important arguments to note are:
 -not means the negation of the expression that follows
    \( means the start of a complex expression.
    \) means the end of a complex expression.
    -o means a logical or of a complex expression.
       In this case the complex expression is all files like '*,v' or '.*,v' 

<source lang="bash" enclose="div">
 for file in `find /opt \( -name error_log -o -name 'access_log' -o -name 'ssl_engine_log' -o -name 'rewrite_log' -o
 -name 'catalina.out' \) -size +300000k -a -size -5000000k`; do cat /dev/null > $file; done
</source>
The units should be one of [bckw], 'b' means 512-byte blocks, 'c' means byte, 'k' means kilobytes and 'w' means 2-byte words. The size does not count indirect blocks, but it does count blocks in sparse files that are not actually allocated.

==See also==
*[[Locate_(Unix)|locate]], a Unix search tool based on a prebuilt database, and therefore it is faster and less accurate than <code>find</code> (because the database may not be up-to-date).
(contracted; show full)*[http://www.oracle.com/technetwork/articles/calish-find-087766.html Guide to Linux Find Command Mastery]
*[http://www.shell-fu.org/lister.php?tag=find Top 'find' commands - interesting usage]

{{Unix commands}}

[[Category:Searching]]
[[Category:Standard Unix programs]]
[[Category:Unix SUS2008 utilities]]