Difference between revisions 507905 and 507906 on knwiki{{otheruses}} {{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) echo "'MyFile*'" |perl -pe 's/([a-zA-Z])/[\L\1\U\1]/g;s/(.*)/find . -name \1/'|sh ===Search files by size=== Example of searching files with size between 100 kilobytes and 500 kilobytes. find . -size +100k -a -size -500k ===Search files by name and size === find /usr/src -not \( -name "*,v" -o -name ".*,v" \) '{}' \; -print 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' ⏎ ⏎ 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 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== *[[GNU locate]], a Unix search tool based on a prebuilt database therefore faster and less accurate than <code>find</code> *[[mdfind]], a similar utility that utilizes metadata for [[Mac OS X]] and [[Darwin (operating system)|Darwin]] *[[List of Unix programs]] *[[List of DOS commands]] *[[find (command)]], a DOS and Windows command that is very different from UNIX <code>find</code> *[[findutils]] ==External links== *{{man|cu|find|SUS|find files}} *{{man|1|find||search for files in a directory hierarchy}} *[http://doc.cat-v.org/unix/find-history A story on the origins of the Unix find command]. *[http://www.gnu.org/software/findutils/ GNU Findutils] - Comes with the [[xargs]] and [[GNU locate|locate]] commands. *[http://www.gnu.org/software/findutils/manual/html_mono/find.html Official webpage for GNU find] *[http://www.softpanorama.org/Tools/Find/find_mini_tutorial.shtml Softpanorama find tutorial] *[http://www.enciclopedia.galeon.com/find.html Exercises "Find"] *[http://find.unixpin.com/ "Find helper" - unix "find" wizard] *[http://www.oracle.com/technology/pub/articles/calish-find.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]] [[de:Find]] [[el:Find]] [[es:Find]] [[fr:Find]] [[it:Find (Unix)]] [[hu:Find]] [[ja:Find]] [[pl:Find]] [[pt:Find]] [[ro:Find]] [[ru:Find]] [[fi:Find (Unix)]] All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://kn.wikipedia.org/w/index.php?diff=prev&oldid=507906.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|