Difference between revisions 507852 and 507853 on knwiki

{{otheruses}}
{{lowercase|title=find}} 
The <code>'''find'''</code> program is a [[directory (file systems)|directory]] [[Search_engine_(computing)|search utility]] on [[Unix-like]] platforms. It searches through one or more directory [[tree (computing)|trees]] of a [[filesystem]], locating [[Computer file|file]]s based on some user-specified criteria. By default, <code>find</code> returns all files below the current [[working directory]]. Further, <c(contracted; show full)
 find / -name "myfile" -type f -print 2>/dev/null

If you are a [[C shell|csh]] or [[tcsh]] user, you cannot redirect [[stderr]] without redirecting [[stdout]] as well.  You can use sh to run the find command to get around this:
 sh -c find / -name "myfile" -type f -print 2>/dev/null


An alternate method when using [[C shell|csh]] or [[tcsh]] is to pipe the output from [[stdout]] and [[stderr]] into a [[grep]] command. This example shows how to suppress lines that contain permission denied errors.
 find . -name "myfile" |& grep -v "Permission denied"

===Find any one of differently named files===
 find . \( -name "*jsp" -o -name "*java" \) -type f -ls

The <code>-ls</code> option prints extended information, and the example finds any file whose name ends with either 'jsp' or 'java'. Note that the parentheses are required. Also note that the operator "or" can be abbreviated as "o". The "and" operator is assumed where no operator is given.  In many shells the parentheses must(contracted; show full)[[fr:Find]]
[[it:Find (Unix)]]
[[hu:Find]]
[[ja:Find]]
[[pl:Find]]
[[pt:Find]]
[[ru:Find]]
[[fi:Find (Unix)]]