FIND(C) XENIX System V FIND(C)
Name
find - Finds files.
Syntax
find pathname-list expression
Description
find recursively descends the directory hierarchy for each
pathname in the pathname-list (i.e., one or more pathnames)
seeking files that match a Boolean expression written in the
primaries given below. In the descriptions, the argument n
is used as a decimal 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 file name.
Normal shell argument syntax may be used if
escaped (watch out for the left bracket ([),
the question mark (?) and the star (*).
-perm onum True if the file permission flags exactly
match the octal number onum (see chmod(C)).
If onum is prefixed by a minus sign, more
flag bits (017777, see stat(S)) become
significant and the flags are compared.
-type x True if the type of the file is x, where c
is b, c, d, p, or f for block special file,
character special file, directory, first-
in-first-out, 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
taken 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 True if the file is n blocks long (512 bytes
per block).
-atime n True if the file has been accessed in n
days.
-mtime n True if the file has been modified in n
days.
-ctime n True if the file has been changed in n days.
Page 1 (printed 8/7/87)
FIND(C) XENIX System V FIND(C)
-exec cmd True if the executed cmd returns a zero
value as exit status. The end of cmd must
be punctuated by an escaped semicolon. A
command argument { } is replaced by the
current path name.
-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.
-cpiodevice Always true; write the current file on
device in cpio(F) format (5120-byte
records).
-print Always true; causes the current path name to
be printed.
-newer file True if the current file has been modified
more recently than the argument file.
( 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):
negation The negation of a primary is specified with
the exclamation (!) unary not operator.
AND The AND operation is implied by the
juxtaposition of two primaries.
OR
The OR operation is specified with the -o
operator given between two primaries.
Example
The following removes all files named a.out or *.out that
have not been accessed for a week:
find / \( -name a.out -o -name '*.out' \) -atime +7 -exec
rm {} \;
Page 2 (printed 8/7/87)
FIND(C) XENIX System V FIND(C)
Files
/etc/passwd
/etc/group
See Also
cpio(C)(F), sh(C), stat(S), test(C)
Page 3 (printed 8/7/87)