rework to make a bit clearer, minor man page syntax stuff;
[unix-history] / usr / src / usr.bin / find / find.1
index 1e6ce44..dd652b9 100644 (file)
@@ -1,4 +1,8 @@
-.\"    @(#)find.1      6.1 (Berkeley) %G%
+.\" Copyright (c) 1985 Regents of the University of California.
+.\" All rights reserved.  The Berkeley software License Agreement
+.\" specifies the terms and conditions for redistribution.
+.\"
+.\"    @(#)find.1      6.4 (Berkeley) %G%
 .\"
 .TH FIND 1 ""
 .AT 3
 .\"
 .TH FIND 1 ""
 .AT 3
 find \- find files
 .SH SYNOPSIS
 .B find
 find \- find files
 .SH SYNOPSIS
 .B find
-pathname-list  expression
+pathname-list expression
 .br 
 .B find
 .br 
 .B find
-name
+pattern
 .SH DESCRIPTION
 .SH DESCRIPTION
-.I Find
+In the first form above,
+.I find
 recursively descends
 the directory hierarchy for
 each pathname in the
 recursively descends
 the directory hierarchy for
 each pathname in the
@@ -35,26 +40,33 @@ and
 means exactly
 .IR n .
 .PP
 means exactly
 .IR n .
 .PP
-The second simplified form will list all files on the system
-whose pathname contains
-.I name.
-This is similar to
-.sp
-.ti
-find / -mtime +0 -name "*<name>*" -print
-.sp
-but much faster.
-As with
-.B -name
-below, shell syntax may be used for
-.I name.
+The second form rapidly searches a database for all pathnames
+which match
+.IR pattern .
+Usually the database is recomputed
+weekly and contains the pathnames
+of all files which are publicly accessible.
+If escaped, normal shell
+\*(lqglobbing\*(rq characters (`*', `?', `[', and ']')
+may be used in
+.IR pattern ,
+but the matching differs in that no characters
+.RI ( e.g. " `/')"
+have to be matched explicitly.
+As a special case, a simple
+.I pattern
+containing no globbing characters
+is matched as though it were
+.IR *pattern* ;
+if any globbing character appears
+there are no implicit globbing characters.
 .TP 10n
 .BR \-name " filename"
 True if the
 .I filename
 argument matches the current file name.
 Normal
 .TP 10n
 .BR \-name " filename"
 True if the
 .I filename
 argument matches the current file name.
 Normal
-Shell
+shell
 argument syntax may be used if escaped (watch out for
 `[', `?' and `*').
 .TP
 argument syntax may be used if escaped (watch out for
 `[', `?' and `*').
 .TP
@@ -99,11 +111,21 @@ True if the file belongs to the user
 .I uname
 (login name or numeric user ID).
 .TP
 .I uname
 (login name or numeric user ID).
 .TP
+.B \-nouser
+True if the file belongs to a user
+.I not
+in the /etc/passwd database.
+.TP
 .BR \-group " gname"
 True if the file belongs to group
 .I gname
 (group name or numeric group ID).
 .TP
 .BR \-group " gname"
 True if the file belongs to group
 .I gname
 (group name or numeric group ID).
 .TP
+.B \-nogroup
+True if the file belongs to a group
+.I not
+in the /etc/group database.
+.TP
 .BR \-size " n"
 True if the file is
 .I n
 .BR \-size " n"
 True if the file is
 .I n
@@ -143,10 +165,52 @@ and the command executed only upon response
 Always true;
 causes the current pathname to be printed.
 .TP
 Always true;
 causes the current pathname to be printed.
 .TP
+.B  \-ls
+Always true;
+causes current pathname to be printed together
+with its associated statistics.
+These include (respectively) inode number,
+size in kilobytes (1024 bytes),
+protection mode,
+number of hard links,
+user,
+group,
+size in bytes,
+and modification time.
+If the file is a special file
+the size field will instead contain the major and minor
+device numbers.
+If the file is a symbolic link the
+pathname of the linked-to file is printed preceded by ``->''.
+The format is identical to that of ``ls -gilds''
+(note however that formatting is done internally,
+without executing the ls program).
+.TP
 .BR \-newer " file"
 True if
 the current file has been modified more recently than the argument
 .I file.
 .BR \-newer " file"
 True if
 the current file has been modified more recently than the argument
 .I file.
+.TP
+.BR \-cpio " file"
+Write the current file on the argument
+.I file
+in
+.I cpio
+format.
+.TP
+.B \-xdev
+Always true;
+causes find
+.I not
+to traverse down into a file system different
+from the one on which current
+.I argument
+pathname resides.
+.TP
+.B \-follow
+Always true;
+causes find to traverse symbolic links to directories.
+Normally find does not traverse symbolic links.
 .PP
 The primaries may be combined using the following operators
 (in order of decreasing precedence):
 .PP
 The primaries may be combined using the following operators
 (in order of decreasing precedence):
@@ -175,24 +239,33 @@ Alternation of primaries
 operator).
 .SH EXAMPLES
 .PP
 operator).
 .SH EXAMPLES
 .PP
-To typeset all variants of manual pages for 'ls':
+To find all accessible files whose pathname contains `find':
+.IP
+find find
+.PP
+To typeset all variants of manual pages for `ls':
 .IP 
 vtroff -man `find '*man*/ls.?'`
 .PP
 To remove all files named
 `a.out' or `*.o' that have not been accessed for a week:
 .IP "" .2i
 .IP 
 vtroff -man `find '*man*/ls.?'`
 .PP
 To remove all files named
 `a.out' or `*.o' that have not been accessed for a week:
 .IP "" .2i
-find / \\( \-name a.out \-o \-name '*.o' \\) \-atime +7 \-exec rm {} \\;
+find / \e( \-name a.out \-o \-name '*.o' \e) \-atime +7 \-exec rm {} \e\;
 .SH FILES
 .SH FILES
+.nf
+.ta \w'/usr/lib/find/find.codes     'u
 /etc/passwd
 /etc/passwd
-.br
 /etc/group
 /etc/group
-.br
-/usr/lib/find/find.codes       coded filenames
+/usr/lib/find/find.codes       coded pathnames database
+.fi
 .SH "SEE ALSO"
 sh(1), test(1), fs(5)
 .br
 Relevant paper in February, 1983 issue of
 .I ;login:.
 .SH BUGS
 .SH "SEE ALSO"
 sh(1), test(1), fs(5)
 .br
 Relevant paper in February, 1983 issue of
 .I ;login:.
 .SH BUGS
-The syntax (except for the second form), is painful.
+The first form's syntax is painful, and
+the second form's exact semantics is confusing and
+can vary from site to site.
+.PP
+More than one `-newer' option does not work properly.