122 lines
3.2 KiB
HTML
122 lines
3.2 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>find(1)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>find(1)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
find - find files meeting a given condition
|
|
|
|
|
|
</PRE>
|
|
<H2>SYNOPSIS</H2><PRE>
|
|
<STRONG>find</STRONG> <EM>directory</EM> <EM>expression</EM>
|
|
|
|
|
|
</PRE>
|
|
<H2>EXAMPLES</H2><PRE>
|
|
|
|
<STRONG>find</STRONG> <STRONG>/</STRONG> <STRONG>-name</STRONG> <STRONG>a.out</STRONG> <STRONG>-print</STRONG>
|
|
# Print all <EM>a</EM>.<EM>out</EM> paths
|
|
|
|
<STRONG>find</STRONG> <STRONG>/usr/ast</STRONG> <STRONG>!</STRONG> <STRONG>-newer</STRONG> <STRONG>f</STRONG> <STRONG>-ok</STRONG> <STRONG>rm</STRONG> <STRONG>{}</STRONG> <STRONG>\\;</STRONG>
|
|
# Ask before removing
|
|
|
|
<STRONG>find</STRONG> <STRONG>/usr</STRONG> <STRONG>-size</STRONG> <STRONG>+20</STRONG> <STRONG>-exec</STRONG> <STRONG>mv</STRONG> <STRONG>{}</STRONG> <STRONG>/big</STRONG> <STRONG>\\;</STRONG>
|
|
# move files > 20 blks
|
|
|
|
<STRONG>find</STRONG> <STRONG>/</STRONG> <STRONG>(</STRONG> <STRONG>-name</STRONG> <STRONG>a.out</STRONG> <STRONG>-o</STRONG> <STRONG>-name</STRONG> <STRONG>'*.o'</STRONG> <STRONG>)</STRONG> <STRONG>-exec</STRONG> <STRONG>rm</STRONG> <STRONG>{}\\;</STRONG>
|
|
# 2 conds
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
|
|
<EM>Find</EM> descends the file tree starting at the given directory checking each
|
|
file in that directory and its subdirectories against a predicate. If
|
|
the predicate is true, an action is taken. The predicates may be
|
|
connected by <STRONG>-a</STRONG> (Boolean and), <STRONG>-o</STRONG> (Boolean or) and ! (Boolean negation).
|
|
Each predicate is true under the conditions specified below. The integer
|
|
<EM>n</EM> may also be +<EM>n</EM> to mean any value greater than <EM>n</EM>, -<EM>n</EM> to mean any value
|
|
less than <EM>n</EM>, or just <EM>n</EM> for exactly <EM>n</EM>.
|
|
|
|
-name s true if current filename is <EM>s</EM> (include shell wild cards)
|
|
-size n true if file size is <EM>n</EM> blocks
|
|
-inum n true if the current file's i-node number is <EM>n</EM>
|
|
-mtime n true if modification time relative to today (in days) is <EM>n</EM>
|
|
-links n true if the number of links to the file is <EM>n</EM>
|
|
-newer f true if the file is newer than <EM>f</EM>
|
|
-perm n true if the file's permission bits = <EM>n</EM> (<EM>n</EM> is in octal)
|
|
-user u true if the uid = <EM>u</EM> (a numerical value, not a login name)
|
|
-group g true if the gid = <EM>g</EM> (a numerical value, not a group name)
|
|
-type x where <EM>x</EM> is <STRONG>bcdfug</STRONG> (block, char, dir, regular file, setuid,
|
|
setgid)
|
|
-xdev do not cross devices to search mounted file systems
|
|
|
|
Following the expression can be one of the following, telling what to do
|
|
when a file is found:
|
|
|
|
-print print the file name on standard output
|
|
-exec execute a MINIX command, {} stands for the file name
|
|
-ok prompts before executing the command
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<STRONG><A HREF="../man1/test.1.html">test(1)</A></STRONG>, <STRONG><A HREF="../man1/xargs.1.html">xargs(1)</A></STRONG>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|