Difference between revisions 508017 and 508018 on knwiki

{{other uses}}
{{unreferenced|date=September 2013}}
{{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(contracted; show full)its position in the hierarchy or terminate.
}}

==Operators ==
Operators can be used to enhance the expressions of the find command. Operators are listed in order of decreasing precedence:

*'''( expr )''' Force precedence. 
*'''! expr''' True if expr is false.
 
*'''-not expr''' Same as ! expr. 
*'''expr1 expr2''' And (implied); expr2 is not evaluated if expr1 is false. 
*'''expr1 -a expr2''' Same as expr1 expr2. 
*'''expr1 -and expr2''' Same as expr1 expr2. 
*'''expr1 -o expr2''' Or; expr2 is not evaluated if expr1 is true. 
*'''expr1 -or expr2''' Same as expr1 -o expr2 but doesn't work as widely (since POSIX doesn't require it). 
*'''expr1, expr2''' List; both expr1 and expr2 are always evaluated. The value of expr1 is discarded (though its side-effects occur); the value of the list is the value of expr2.

 find . -name 'fileA_*' -o -name 'fileB_*'

This command searches files whose name has a prefix of "fileA_" or "fileB_" in the current directory.

 find . -name 'foo.cpp' '!' -path '.svn'

(contracted; show full)*{{man|1|find||search for files in a directory hierarchy}}
*[http://www.gnu.org/software/findutils/manual/html_mono/find.html Official webpage for GNU find]

{{Unix commands}}

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