Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ find(1) — A/UX 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1)

cpio(1)

csh(1)

ksh(1)

sh(1)

xargs(1)

ff(1M)

stat(2)

cpio(4)

fs(4)




find(1) find(1)
NAME find - find files SYNOPSIS find pathname-list expression DESCRIPTION find recursively descends the directory hierarchy for each pathname in the pathname-list (that is, one or more path- names) seeking files that match a boolean expression written in the primaries given below. find does not follow symbolic links. In the descriptions, the argument n is used as a de- cimal integer, where +n means more than n, -n means less than n, and n means exactly n. -name file True if file matches the current filename. Normal shell argument syntax may be used if escaped (watch out for [, ?, and *). -perm onum True if the file permission flags exactly match the octal number onum (see chmod(1)). If onum is prefixed by a minus sign, more flag bits (017777, see stat(2)) become significant and the flags are compared: (flags & onum) == onum -type c True if the type of the file is c, where c is b, c, d, l, p, or f for block special file, character special file, directory, symbolic link, fifo (named pipe), or plain file, respectively. -links n True if the file has n links. -user uname True if the file belongs to the user uname. If uname is numeric and does not appear as a login name in the /etc/passwd file, it is tak- en as a user ID. -group gname True if the file belongs to the group gname. If gname is numeric and does not appear in the /etc/group file, it is taken as a group ID. -size n[c] True if the file is n blocks long (512 bytes per block). If n is followed by a c, the size is in characters. -atime n True if the file has been accessed in n days. The access time of directories in pathname- list is changed by find itself. April, 1990 1



find(1) find(1)
-mtime n True if the file has been modified in n days. -ctime n True if the file has been changed in n days. -exec cmd True if the executed cmd returns a zero value as exit status. The end of cmd must be punc- tuated by an escaped semicolon. A command ar- gument of the form {} is replaced by the current pathname. -ok cmd Like -exec, except that the generated command line is printed with a question mark first, and is executed only if the user responds by typing y. -print Always true; causes the current pathname to be printed. -cpio device Always true; write the current file on device in cpio(4) format (512-byte records). -newer file True if the current file has been modified more recently than the argument file. -depth Always true; causes descent of the directory hierarchy to be done so that all entries in a directory are acted on before the directory itself. This can be useful when find is used with cpio(1) to transfer files that are con- tained in directories without write permis- sion. (expression) True if the parenthesized expression is true (parentheses are special to the shell and must be escaped). The primaries may be combined using the following operators (in order of decreasing precedence): 1. The negation of a primary (! is the unary NOT opera- tor). 2. Concatenation of primaries (the AND operation is implied by the juxtaposition of two primaries). 3. Alternation of primaries (-o is the OR operator). EXAMPLES The command find / -perm 755 -exec ls "{}" ";" 2 April, 1990



find(1) find(1)
will find all files, starting with the root directory, on which the permission levels have been set to 755 (see chmod(1)). With -exec and a command such as ls, it is often necessary to escape the {} that stores the current pathname under in- vestigation by putting it in double quotes. It is always necessary to escape the semicolon at the end of an -exec se- quence. Note again that it is also necessary to escape parentheses used for grouping primaries, by means of a backslash, as il- lustrated: find \( -name a.out -o -name '*.o' \) -exec rm {} \; removes all files named a.out or *.o. FILES /bin/find /etc/passwd /etc/group SEE ALSO chmod(1), cpio(1), csh(1), ksh(1), sh(1), xargs(1), ff(1M), stat(2), cpio(4), fs(4), ``Other Tools'' in A/UX Programming Languages and Tools, Volume 2. April, 1990 3

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026