Difference between revisions 507839 and 507840 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: echo "mv ./3bfn rel071204": No such file or directory

which means that '''find''' is trying to run a file called 'echo "mv ./3bfn rel071204"' and failing.

If you will be executing over many results, it is more efficient to pipe the results to the [[xargs]] command instead.


If running under Windows, don't include the backslash before the semicolon:

 find . -exec grep blah {} ;

===Search for a string===
This command will search for a string in all files from the /tmp directory and below:

 find /tmp -exec grep "search string" '{}' /dev/null \; -print

The <tt>[[/dev/null]]</tt> argument is used to show the name of the file before the text that is found. Without it, only the text found is printed.  An equivalent mechanism is to use the "-H" or "--with-filename" option to grep:

(contracted; show full)[[es:Find]]
[[fr:Find]]
[[it:Find (Unix)]]
[[hu:Find]]
[[ja:Find]]
[[pl:Find]]
[[pt:Find]]
[[ru:Find]]