Difference between revisions 507999 and 508000 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)viated as "o". The "and" operator is assumed where no operator is given.  In many shells the parentheses must be escaped with a backslash, "\(" and "\)", to prevent them from being interpreted as special shell characters. The <code>-ls</code> option and the <code>-or</code> operator are not available on all versions of <code>find</code>.

===Execute an action===
 find /var/ftp/mp3 -name '*.mp3' -type f -exec chmod 644 {} 
'\;
This command changes the [[File system permissions|permissions]] of all files with a name ending in ''.mp3'' in the directory ''/var/ftp/mp3''. The  action is carried out by specifying the option <code>-exec [[chmod]] 644 {} \;</code> in the command. For every file whose name ends in <code>.mp3</code>, the command <code>chmod 644 {}</code> is executed replacing <code>{}</code> with the name of the file. The semicolon (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]]