V6/usr/man/man1/find.1
.th FIND I 5/15/74
.sh NAME
find \*- find files
.sh SYNOPSIS
.bd find
pathname expression
.sh DESCRIPTION
.it Find
recursively descends
the directory hierarchy from
.it pathname
seeking files that match a boolean
.it expression
written in the primaries given below.
In the descriptions, the argument
.it n
is used as a decimal integer
where
.it +n
means more than
.it n,
.it \*-n
means less than
.it n
and
.it n
means exactly
.it n.
.s3
.lp +16 16
\fB\*-name\fR filename True if the
.it filename
argument matches the current file name.
Normal
.it Shell
argument syntax may be used if escaped (watch out for
`[', `?' and `*').
.s3
.lp +16 16
\fB\*-perm\fR onum \c
True if the file permission flags
exactly
match the
octal number
.it onum
(see chmod(I)).
If
.it onum
is prefixed by a minus sign,
more flag bits (017777, see stat(II)) become significant and
the flags are compared:
.it "(flags&onum)==onum."
.s3
.lp +16 16
\fB\*-type\fI c\fR True if the type of the file
is
.it c,
where
.it c
is
.bd "b, c, d"
or
.bd f
for
block special file, character special file,
directory or plain file.
.s3
.lp +16 16
\fB\*-links\fI n\fR \c
True if the file has
.it n
links.
.s3
.lp +16 16
\fB\*-user\fR uname \c
True if the file belongs to the user
.it uname.
.s3
.lp +16 16
\fB\*-group\fR gname \c
As it is for
.bd \*-user
so shall it be for
.bd \*-group
(someday).
.s3
.lp +16 16
\fB\*-size\fI n\fR \c
True if the file is
.it n
blocks long (512 bytes per block).
.s3
.lp +16 16
\fB\*-atime\fI n\fR \c
True if the file has been accessed in
.it n
days.
.s3
.lp +16 16
\fB\*-mtime\fI n\fR \c
True if the file has been modified in
.it n
days.
.s3
.lp +16 16
\fB\*-exec\fR command \c
True if the executed command returns
exit status zero
(most commands do).
The end of the command is punctuated by an escaped
semicolon.
A command argument `{}' is replaced by the
current pathname.
.s3
.lp +16 16
\fB\*-ok\fR command \c
Like
.bd \*-exec
except that the generated command line is printed
with a question mark first,
and is executed only if the user responds
\fBy\fR.
.s3
.lp +16 16
\fB\*-print\fR \c
Always true;
causes the current pathname to be printed.
.s3
.i0
The primaries may be combined with
these operators
(ordered by precedence):
.s3
.lp +16 16
\fB!\fR prefix
.it not
.s3
.lp +16 16
\fB\*-a\fR infix
.it and,
second operand evaluated only if first is true
.s3
.lp +16 16
\fB\*-o\fR infix
.it or,
second operand evaluated only if first is false
.s3
.lp +16 16
\fB( \fRexpression\fB )\fR parentheses for grouping.
(Must be escaped.)
.s3
.i0
To remove files named
`a.out' and `*.o' not accessed for a week:
.s3
.lp +.5i 0
find / "(" \*-name a.out \*-o \*-name "*.o" ")"
\*-a \*-atime +7 \*-a \*-exec rm {} ";"
.i0
.sh FILES
/etc/passwd
.sh "SEE ALSO"
sh (I), if(I), file system (V)
.sh BUGS
There is no way to check device type.
.br
Syntax should be reconciled with
.it if.