xref: /freebsd/usr.bin/find/find.1 (revision b8923d4cc02d00f2b5f3a265b1a9718e3d28dd46)
19b50d902SRodney W. Grimes.\" Copyright (c) 1990, 1993
29b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
39b50d902SRodney W. Grimes.\"
49b50d902SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
59b50d902SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc.
69b50d902SRodney W. Grimes.\"
79b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
89b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
99b50d902SRodney W. Grimes.\" are met:
109b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
119b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
129b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
139b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
149b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
159b50d902SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
169b50d902SRodney W. Grimes.\"    must display the following acknowledgement:
179b50d902SRodney W. Grimes.\"	This product includes software developed by the University of
189b50d902SRodney W. Grimes.\"	California, Berkeley and its contributors.
199b50d902SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
209b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
219b50d902SRodney W. Grimes.\"    without specific prior written permission.
229b50d902SRodney W. Grimes.\"
239b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
249b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
259b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
269b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
279b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
289b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
299b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
309b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
319b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
329b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
339b50d902SRodney W. Grimes.\" SUCH DAMAGE.
349b50d902SRodney W. Grimes.\"
359b50d902SRodney W. Grimes.\"	@(#)find.1	8.4 (Berkeley) 4/1/94
36b8923d4cSWolfram Schneider.\"	$Id$
379b50d902SRodney W. Grimes.\"
389b50d902SRodney W. Grimes.Dd April 1, 1994
399b50d902SRodney W. Grimes.Dt FIND 1
409b50d902SRodney W. Grimes.Os
419b50d902SRodney W. Grimes.Sh NAME
429b50d902SRodney W. Grimes.Nm find
439b50d902SRodney W. Grimes.Nd walk a file hierarchy
449b50d902SRodney W. Grimes.Sh SYNOPSIS
459b50d902SRodney W. Grimes.Nm find
469b50d902SRodney W. Grimes.Op Fl H | Fl L | Fl P
479b50d902SRodney W. Grimes.Op Fl Xdx
489b50d902SRodney W. Grimes.Op Fl f Ar file
499b50d902SRodney W. Grimes.Op Ar file ...
509b50d902SRodney W. Grimes.Ar expression
519b50d902SRodney W. Grimes.Sh DESCRIPTION
529b50d902SRodney W. Grimes.Nm Find
539b50d902SRodney W. Grimesrecursively descends the directory tree for each
549b50d902SRodney W. Grimes.Ar file
559b50d902SRodney W. Grimeslisted, evaluating an
569b50d902SRodney W. Grimes.Ar expression
579b50d902SRodney W. Grimes(composed of the ``primaries'' and ``operands'' listed below) in terms
589b50d902SRodney W. Grimesof each file in the tree.
599b50d902SRodney W. Grimes.Pp
609b50d902SRodney W. GrimesThe options are as follows:
619b50d902SRodney W. Grimes.Pp
629b50d902SRodney W. Grimes.Bl -tag -width Ds
639b50d902SRodney W. Grimes.It Fl H
649b50d902SRodney W. GrimesThe
659b50d902SRodney W. Grimes.Fl H
669b50d902SRodney W. Grimesoption causes the file information and file type (see
679b50d902SRodney W. Grimes.Xr stat 2)
689b50d902SRodney W. Grimesreturned for each symbolic link specified on the command line to be
699b50d902SRodney W. Grimesthose of the file referenced by the link, not the link itself.
709b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will
719b50d902SRodney W. Grimesbe for the link itself.  File information of all symbolic links not on
729b50d902SRodney W. Grimesthe command line is that of the link itself.
739b50d902SRodney W. Grimes.It Fl L
749b50d902SRodney W. GrimesThe
759b50d902SRodney W. Grimes.Fl L
769b50d902SRodney W. Grimesoption causes the file information and file type (see
779b50d902SRodney W. Grimes.Xr stat 2)
789b50d902SRodney W. Grimesreturned for each symbolic link to be those of the file referenced by the
799b50d902SRodney W. Grimeslink, not the link itself.
809b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will
819b50d902SRodney W. Grimesbe for the link itself.
829b50d902SRodney W. Grimes.It Fl P
839b50d902SRodney W. GrimesThe
849b50d902SRodney W. Grimes.Fl P
859b50d902SRodney W. Grimesoption causes the file information and file type (see
869b50d902SRodney W. Grimes.Xr stat 2)
879b50d902SRodney W. Grimesreturned for each symbolic link to be those of the link itself.
889b50d902SRodney W. Grimes.It Fl X
899b50d902SRodney W. GrimesThe
909b50d902SRodney W. Grimes.Fl X
919b50d902SRodney W. Grimesoption is a modification to permit
929b50d902SRodney W. Grimes.Nm
939b50d902SRodney W. Grimesto be safely used in conjunction with
949b50d902SRodney W. Grimes.Xr xargs 1 .
959b50d902SRodney W. GrimesIf a file name contains any of the delimiting characters used by
969b50d902SRodney W. Grimes.Xr xargs ,
979b50d902SRodney W. Grimesa diagnostic message is displayed on standard error, and the file
989b50d902SRodney W. Grimesis skipped.
999b50d902SRodney W. GrimesThe delimiting characters include single (`` ' '') and double (`` " '')
1009b50d902SRodney W. Grimesquotes, backslash (``\e''), space, tab and newline characters.
1019b50d902SRodney W. Grimes.It Fl d
1029b50d902SRodney W. GrimesThe
1039b50d902SRodney W. Grimes.Fl d
1049b50d902SRodney W. Grimesoption causes
1059b50d902SRodney W. Grimes.Nm find
1069b50d902SRodney W. Grimesto perform a depth\-first traversal, i.e. directories
1079b50d902SRodney W. Grimesare visited in post\-order and all entries in a directory will be acted
1089b50d902SRodney W. Grimeson before the directory itself.
1099b50d902SRodney W. GrimesBy default,
1109b50d902SRodney W. Grimes.Nm find
1119b50d902SRodney W. Grimesvisits directories in pre\-order, i.e. before their contents.
1129b50d902SRodney W. GrimesNote, the default is
1139b50d902SRodney W. Grimes.Ar not
1149b50d902SRodney W. Grimesa breadth\-first traversal.
1159b50d902SRodney W. Grimes.It Fl f
1169b50d902SRodney W. GrimesThe
1179b50d902SRodney W. Grimes.Fl f
1189b50d902SRodney W. Grimesoption specifies a file hierarchy for
1199b50d902SRodney W. Grimes.Nm find
1209b50d902SRodney W. Grimesto traverse.
1219b50d902SRodney W. GrimesFile hierarchies may also be specified as the operands immediately
1229b50d902SRodney W. Grimesfollowing the options.
1239b50d902SRodney W. Grimes.It Fl x
1249b50d902SRodney W. GrimesThe
1259b50d902SRodney W. Grimes.Fl x
1269b50d902SRodney W. Grimesoption prevents
1279b50d902SRodney W. Grimes.Nm find
1289b50d902SRodney W. Grimesfrom descending into directories that have a device number different
1299b50d902SRodney W. Grimesthan that of the file from which the descent began.
1309b50d902SRodney W. Grimes.El
1319b50d902SRodney W. Grimes.Sh PRIMARIES
1329b50d902SRodney W. Grimes.Bl -tag -width Ds
1339b50d902SRodney W. Grimes.It Ic -atime Ar n
1349b50d902SRodney W. GrimesTrue if the difference between the file last access time and the time
1359b50d902SRodney W. Grimes.Nm find
1369b50d902SRodney W. Grimeswas started, rounded up to the next full 24\-hour period, is
1379b50d902SRodney W. Grimes.Ar n
1389b50d902SRodney W. Grimes24\-hour periods.
1399b50d902SRodney W. Grimes.It Ic -ctime Ar n
1409b50d902SRodney W. GrimesTrue if the difference between the time of last change of file status
1419b50d902SRodney W. Grimesinformation and the time
1429b50d902SRodney W. Grimes.Nm find
1439b50d902SRodney W. Grimeswas started, rounded up to the next full 24\-hour period, is
1449b50d902SRodney W. Grimes.Ar n
1459b50d902SRodney W. Grimes24\-hour periods.
1469b50d902SRodney W. Grimes.It Ic -exec Ar utility Op argument ... ;
1479b50d902SRodney W. GrimesTrue if the program named
1489b50d902SRodney W. Grimes.Ar utility
1499b50d902SRodney W. Grimesreturns a zero value as its exit status.
1509b50d902SRodney W. GrimesOptional arguments may be passed to the utility.
1519b50d902SRodney W. GrimesThe expression must be terminated by a semicolon (``;'').
1529b50d902SRodney W. GrimesIf the string ``{}'' appears anywhere in the utility name or the
1539b50d902SRodney W. Grimesarguments it is replaced by the pathname of the current file.
1549b50d902SRodney W. Grimes.Ar Utility
1559b50d902SRodney W. Grimeswill be executed from the directory from which
1569b50d902SRodney W. Grimes.Nm find
1579b50d902SRodney W. Grimeswas executed.
1589b50d902SRodney W. Grimes.It Ic -fstype Ar type
1599b50d902SRodney W. GrimesTrue if the file is contained in a file system of type
1609b50d902SRodney W. Grimes.Ar type .
1619b50d902SRodney W. GrimesCurrently supported types are ``local'', ``mfs'', ``nfs'', ``msdos'',
1629b50d902SRodney W. Grimes``rdonly'' and ``ufs''.
1639b50d902SRodney W. GrimesThe types ``local'' and ``rdonly'' are not specific file system types.
1649b50d902SRodney W. GrimesThe former matches any file system physically mounted on the system where
1659b50d902SRodney W. Grimesthe
1669b50d902SRodney W. Grimes.Nm find
1679b50d902SRodney W. Grimesis being executed and the latter matches any file system which is
1689b50d902SRodney W. Grimesmounted read-only.
1699b50d902SRodney W. Grimes.It Ic -group Ar gname
1709b50d902SRodney W. GrimesTrue if the file belongs to the group
1719b50d902SRodney W. Grimes.Ar gname  .
1729b50d902SRodney W. GrimesIf
1739b50d902SRodney W. Grimes.Ar gname
1749b50d902SRodney W. Grimesis numeric and there is no such group name, then
1759b50d902SRodney W. Grimes.Ar gname
1769b50d902SRodney W. Grimesis treated as a group id.
1779b50d902SRodney W. Grimes.It Ic -inum Ar n
1789b50d902SRodney W. GrimesTrue if the file has inode number
1799b50d902SRodney W. Grimes.Ar n  .
1809b50d902SRodney W. Grimes.It Ic -links Ar n
1819b50d902SRodney W. GrimesTrue if the file has
1829b50d902SRodney W. Grimes.Ar n
1839b50d902SRodney W. Grimeslinks.
1849b50d902SRodney W. Grimes.It Ic -ls
1859b50d902SRodney W. GrimesThis primary always evaluates to true.
1869b50d902SRodney W. GrimesThe following information for the current file is written to standard output:
1879b50d902SRodney W. Grimesits inode number, size in 512\-byte blocks, file permissions, number of hard
1889b50d902SRodney W. Grimeslinks, owner, group, size in bytes, last modification time, and pathname.
1899b50d902SRodney W. GrimesIf the file is a block or character special file, the major and minor numbers
1909b50d902SRodney W. Grimeswill be displayed instead of the size in bytes.
1919b50d902SRodney W. GrimesIf the file is a symbolic link, the pathname of the linked\-to file will be
1929b50d902SRodney W. Grimesdisplayed preceded by ``\->''.
1939b50d902SRodney W. GrimesThe format is identical to that produced by ``ls \-dgils''.
1949b50d902SRodney W. Grimes.It Ic -mtime Ar n
1959b50d902SRodney W. GrimesTrue if the difference between the file last modification time and the time
1969b50d902SRodney W. Grimes.Nm find
1979b50d902SRodney W. Grimeswas started, rounded up to the next full 24\-hour period, is
1989b50d902SRodney W. Grimes.Ar n
1999b50d902SRodney W. Grimes24\-hour periods.
2009b50d902SRodney W. Grimes.It Ic \&-ok Ar utility Ns Op argument ... ;
2019b50d902SRodney W. GrimesThe
2029b50d902SRodney W. Grimes.Ic \&-ok
2039b50d902SRodney W. Grimesprimary is identical to the
2049b50d902SRodney W. Grimes.Ic -exec
2059b50d902SRodney W. Grimesprimary with the exception that
2069b50d902SRodney W. Grimes.Nm find
2079b50d902SRodney W. Grimesrequests user affirmation for the execution of the utility by printing
2089b50d902SRodney W. Grimesa message to the terminal and reading a response.
2099b50d902SRodney W. GrimesIf the response is other than ``y'' the command is not executed and the
2109b50d902SRodney W. Grimesvalue of the
2119b50d902SRodney W. Grimes.Ar \&ok
2129b50d902SRodney W. Grimesexpression is false.
2139b50d902SRodney W. Grimes.It Ic -name Ar pattern
2149b50d902SRodney W. GrimesTrue if the last component of the pathname being examined matches
2159b50d902SRodney W. Grimes.Ar pattern  .
2169b50d902SRodney W. GrimesSpecial shell pattern matching characters (``['', ``]'', ``*'', and ``?'')
2179b50d902SRodney W. Grimesmay be used as part of
2189b50d902SRodney W. Grimes.Ar pattern  .
2199b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a
2209b50d902SRodney W. Grimesbackslash (``\e'').
2219b50d902SRodney W. Grimes.It Ic -newer Ar file
2229b50d902SRodney W. GrimesTrue if the current file has a more recent last modification time than
2239b50d902SRodney W. Grimes.Ar file  .
2249b50d902SRodney W. Grimes.It Ic -nouser
2259b50d902SRodney W. GrimesTrue if the file belongs to an unknown user.
2269b50d902SRodney W. Grimes.It Ic -nogroup
2279b50d902SRodney W. GrimesTrue if the file belongs to an unknown group.
2289b50d902SRodney W. Grimes.It Ic -path Ar pattern
2299b50d902SRodney W. GrimesTrue if the pathname being examined matches
2309b50d902SRodney W. Grimes.Ar pattern  .
2319b50d902SRodney W. GrimesSpecial shell pattern matching characters (``['', ``]'', ``*'', and ``?'')
2329b50d902SRodney W. Grimesmay be used as part of
2339b50d902SRodney W. Grimes.Ar pattern  .
2349b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a
2359b50d902SRodney W. Grimesbackslash (``\e'').
2369b50d902SRodney W. GrimesSlashes (``/'') are treated as normal characters and do not have to be
2379b50d902SRodney W. Grimesmatched explicitly.
2389b50d902SRodney W. Grimes.It Ic -perm Op Fl Ns Ar mode
2399b50d902SRodney W. GrimesThe
2409b50d902SRodney W. Grimes.Ar mode
2419b50d902SRodney W. Grimesmay be either symbolic (see
2429b50d902SRodney W. Grimes.Xr chmod  1  )
2439b50d902SRodney W. Grimesor an octal number.
2449b50d902SRodney W. GrimesIf the mode is symbolic, a starting value of zero is assumed and the
2459b50d902SRodney W. Grimesmode sets or clears permissions without regard to the process' file mode
2469b50d902SRodney W. Grimescreation mask.
2479b50d902SRodney W. GrimesIf the mode is octal, only bits 07777
2489b50d902SRodney W. Grimes.Pf ( Dv S_ISUID
2499b50d902SRodney W. Grimes|
2509b50d902SRodney W. Grimes.Dv S_ISGID
2519b50d902SRodney W. Grimes|
2529b50d902SRodney W. Grimes.Dv S_ISTXT
2539b50d902SRodney W. Grimes|
2549b50d902SRodney W. Grimes.Dv S_IRWXU
2559b50d902SRodney W. Grimes|
2569b50d902SRodney W. Grimes.Dv S_IRWXG
2579b50d902SRodney W. Grimes|
2589b50d902SRodney W. Grimes.Dv S_IRWXO )
2599b50d902SRodney W. Grimesof the file's mode bits participate
2609b50d902SRodney W. Grimesin the comparison.
2619b50d902SRodney W. GrimesIf the mode is preceded by a dash (``\-''), this primary evaluates to true
2629b50d902SRodney W. Grimesif at least all of the bits in the mode are set in the file's mode bits.
2639b50d902SRodney W. GrimesIf the mode is not preceded by a dash, this primary evaluates to true if
2649b50d902SRodney W. Grimesthe bits in the mode exactly match the file's mode bits.
2659b50d902SRodney W. GrimesNote, the first character of a symbolic mode may not be a dash (``\-'').
2669b50d902SRodney W. Grimes.It Ic -print
2679b50d902SRodney W. GrimesThis primary always evaluates to true.
2689b50d902SRodney W. GrimesIt prints the pathname of the current file to standard output.
2697cd23434SGarrett WollmanThe expression is appended to the user specified expression if none of
2709b50d902SRodney W. Grimes.Ic -exec ,
2717cd23434SGarrett Wollman.Ic -ls ,
2727cd23434SGarrett Wollman.Ic -print0 ,
2739b50d902SRodney W. Grimesor
2749b50d902SRodney W. Grimes.Ic \&-ok
2757cd23434SGarrett Wollmanare specified.
2767cd23434SGarrett Wollman.It Ic -print0
2777cd23434SGarrett WollmanThis primary always evaluates to true.
2787cd23434SGarrett WollmanIt prints the pathname of the current file to standard output, followed by a
2797cd23434SGarrett Wollman.Tn ASCII
2807cd23434SGarrett Wollman.Tn NUL
2817cd23434SGarrett Wollmancharacter (character code 0).
2829b50d902SRodney W. Grimes.It Ic -prune
2839b50d902SRodney W. GrimesThis primary always evaluates to true.
2849b50d902SRodney W. GrimesIt causes
2859b50d902SRodney W. Grimes.Nm find
2869b50d902SRodney W. Grimesto not descend into the current file.
2879b50d902SRodney W. GrimesNote, the
2889b50d902SRodney W. Grimes.Ic -prune
2899b50d902SRodney W. Grimesprimary has no effect if the
2909b50d902SRodney W. Grimes.Fl d
2919b50d902SRodney W. Grimesoption was specified.
2929b50d902SRodney W. Grimes.It Ic -size Ar n Ns Op Cm c
2939b50d902SRodney W. GrimesTrue if the file's size, rounded up, in 512\-byte blocks is
2949b50d902SRodney W. Grimes.Ar n  .
2959b50d902SRodney W. GrimesIf
2969b50d902SRodney W. Grimes.Ar n
2979b50d902SRodney W. Grimesis followed by a ``c'', then the primary is true if the
2989b50d902SRodney W. Grimesfile's size is
2999b50d902SRodney W. Grimes.Ar n
3009b50d902SRodney W. Grimesbytes.
3019b50d902SRodney W. Grimes.It Ic -type Ar t
3029b50d902SRodney W. GrimesTrue if the file is of the specified type.
3039b50d902SRodney W. GrimesPossible file types are as follows:
3049b50d902SRodney W. Grimes.Pp
3059b50d902SRodney W. Grimes.Bl -tag -width flag -offset indent -compact
3069b50d902SRodney W. Grimes.It Cm b
3079b50d902SRodney W. Grimesblock special
3089b50d902SRodney W. Grimes.It Cm c
3099b50d902SRodney W. Grimescharacter special
3109b50d902SRodney W. Grimes.It Cm d
3119b50d902SRodney W. Grimesdirectory
3129b50d902SRodney W. Grimes.It Cm f
3139b50d902SRodney W. Grimesregular file
3149b50d902SRodney W. Grimes.It Cm l
3159b50d902SRodney W. Grimessymbolic link
3169b50d902SRodney W. Grimes.It Cm p
3179b50d902SRodney W. GrimesFIFO
3189b50d902SRodney W. Grimes.It Cm s
3199b50d902SRodney W. Grimessocket
3209b50d902SRodney W. Grimes.El
3219b50d902SRodney W. Grimes.Pp
3229b50d902SRodney W. Grimes.It Ic -user Ar uname
3239b50d902SRodney W. GrimesTrue if the file belongs to the user
3249b50d902SRodney W. Grimes.Ar uname  .
3259b50d902SRodney W. GrimesIf
3269b50d902SRodney W. Grimes.Ar uname
3279b50d902SRodney W. Grimesis numeric and there is no such user name, then
3289b50d902SRodney W. Grimes.Ar uname
3299b50d902SRodney W. Grimesis treated as a user id.
3309b50d902SRodney W. Grimes.El
3319b50d902SRodney W. Grimes.Pp
3329b50d902SRodney W. GrimesAll primaries which take a numeric argument allow the number to be
3339b50d902SRodney W. Grimespreceded by a plus sign (``+'') or a minus sign (``\-'').
3349b50d902SRodney W. GrimesA preceding plus sign means ``more than n'', a preceding minus sign means
3359b50d902SRodney W. Grimes``less than n'' and neither means ``exactly n'' .
3369b50d902SRodney W. Grimes.Sh OPERATORS
3379b50d902SRodney W. GrimesThe primaries may be combined using the following operators.
3389b50d902SRodney W. GrimesThe operators are listed in order of decreasing precedence.
3399b50d902SRodney W. Grimes.Bl -tag -width (expression)
3409b50d902SRodney W. Grimes.It Cm \&( Ns Ar expression Ns Cm \&)
3419b50d902SRodney W. GrimesThis evaluates to true if the parenthesized expression evaluates to
3429b50d902SRodney W. Grimestrue.
3439b50d902SRodney W. Grimes.Pp
3449b50d902SRodney W. Grimes.It Cm \&! Ns Ar expression
3459b50d902SRodney W. GrimesThis is the unary
3469b50d902SRodney W. Grimes.Tn NOT
3479b50d902SRodney W. Grimesoperator.
3489b50d902SRodney W. GrimesIt evaluates to true if the expression is false.
3499b50d902SRodney W. Grimes.Pp
3509b50d902SRodney W. Grimes.It Ar expression Cm -and Ar expression
3519b50d902SRodney W. Grimes.It Ar expression expression
3529b50d902SRodney W. GrimesThe
3539b50d902SRodney W. Grimes.Cm -and
3549b50d902SRodney W. Grimesoperator is the logical
3559b50d902SRodney W. Grimes.Tn AND
3569b50d902SRodney W. Grimesoperator.
3579b50d902SRodney W. GrimesAs it is implied by the juxtaposition of two expressions it does not
3589b50d902SRodney W. Grimeshave to be specified.
3599b50d902SRodney W. GrimesThe expression evaluates to true if both expressions are true.
3609b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is false.
3619b50d902SRodney W. Grimes.Pp
3629b50d902SRodney W. Grimes.It Ar expression Cm -or Ar expression
3639b50d902SRodney W. GrimesThe
3649b50d902SRodney W. Grimes.Cm -or
3659b50d902SRodney W. Grimesoperator is the logical
3669b50d902SRodney W. Grimes.Tn OR
3679b50d902SRodney W. Grimesoperator.
3689b50d902SRodney W. GrimesThe expression evaluates to true if either the first or the second expression
3699b50d902SRodney W. Grimesis true.
3709b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is true.
3719b50d902SRodney W. Grimes.El
3729b50d902SRodney W. Grimes.Pp
3739b50d902SRodney W. GrimesAll operands and primaries must be separate arguments to
3749b50d902SRodney W. Grimes.Nm find  .
3759b50d902SRodney W. GrimesPrimaries which themselves take arguments expect each argument
3769b50d902SRodney W. Grimesto be a separate argument to
3779b50d902SRodney W. Grimes.Nm find  .
3789b50d902SRodney W. Grimes.Sh EXAMPLES
3799b50d902SRodney W. Grimes.Pp
3809b50d902SRodney W. GrimesThe following examples are shown as given to the shell:
3819b50d902SRodney W. Grimes.Bl -tag -width findx
3829b50d902SRodney W. Grimes.It Li "find  /  \e!  -name  \*q*.c\*q  -print"
3839b50d902SRodney W. GrimesPrint out a list of all the files whose names do not end in ``.c''.
3849b50d902SRodney W. Grimes.It Li "find  /  -newer  ttt  -user  wnj  -print"
3859b50d902SRodney W. GrimesPrint out a list of all the files owned by user ``wnj'' that are newer
3869b50d902SRodney W. Grimesthan the file ``ttt''.
3879b50d902SRodney W. Grimes.It Li "find  /  \e!  \e(  -newer  ttt  -user  wnj  \e)  -print"
3889b50d902SRodney W. GrimesPrint out a list of all the files which are not both newer than ``ttt''
3899b50d902SRodney W. Grimesand owned by ``wnj''.
3909b50d902SRodney W. Grimes.It Li "find  /  \e(  -newer  ttt  -or  -user wnj  \e)  -print"
3919b50d902SRodney W. GrimesPrint out a list of all the files that are either owned by ``wnj'' or
3929b50d902SRodney W. Grimesthat are newer than ``ttt''.
3939b50d902SRodney W. Grimes.El
3949b50d902SRodney W. Grimes.Sh SEE ALSO
3959b50d902SRodney W. Grimes.Xr chmod 1 ,
3969b50d902SRodney W. Grimes.Xr locate 1 ,
3979b50d902SRodney W. Grimes.Xr stat 2 ,
3989b50d902SRodney W. Grimes.Xr fts 3 ,
3999b50d902SRodney W. Grimes.Xr getgrent 3 ,
4009b50d902SRodney W. Grimes.Xr getpwent 3 ,
4019b50d902SRodney W. Grimes.Xr strmode 3 ,
4029b50d902SRodney W. Grimes.Xr symlink 7
4039b50d902SRodney W. Grimes.Sh STANDARDS
4049b50d902SRodney W. GrimesThe
4059b50d902SRodney W. Grimes.Nm find
4069b50d902SRodney W. Grimesutility syntax is a superset of the syntax specified by the
4079b50d902SRodney W. Grimes.St -p1003.2
4089b50d902SRodney W. Grimesstandard.
4099b50d902SRodney W. Grimes.Pp
4109b50d902SRodney W. GrimesThe
4119b50d902SRodney W. Grimes.Fl s
4129b50d902SRodney W. Grimesand
4139b50d902SRodney W. Grimes.Fl X
4149b50d902SRodney W. Grimesoptions and the
4157cd23434SGarrett Wollman.Ic -inum ,
4167cd23434SGarrett Wollman.Ic -print0 ,
4179b50d902SRodney W. Grimesand
4189b50d902SRodney W. Grimes.Ic -ls
4199b50d902SRodney W. Grimesprimaries are extensions to
4209b50d902SRodney W. Grimes.St -p1003.2 .
4219b50d902SRodney W. Grimes.Pp
4229b50d902SRodney W. GrimesHistorically, the
4239b50d902SRodney W. Grimes.Fl d ,
4249b50d902SRodney W. Grimes.Fl h
4259b50d902SRodney W. Grimesand
4269b50d902SRodney W. Grimes.Fl x
4279b50d902SRodney W. Grimesoptions were implemented using the primaries ``\-depth'', ``\-follow'',
4289b50d902SRodney W. Grimesand ``\-xdev''.
4299b50d902SRodney W. GrimesThese primaries always evaluated to true.
4309b50d902SRodney W. GrimesAs they were really global variables that took effect before the traversal
4319b50d902SRodney W. Grimesbegan, some legal expressions could have unexpected results.
4329b50d902SRodney W. GrimesAn example is the expression ``\-print \-o \-depth''.
4339b50d902SRodney W. GrimesAs \-print always evaluates to true, the standard order of evaluation
4349b50d902SRodney W. Grimesimplies that \-depth would never be evaluated.
4359b50d902SRodney W. GrimesThis is not the case.
4369b50d902SRodney W. Grimes.Pp
4379b50d902SRodney W. GrimesThe operator ``-or'' was implemented as ``\-o'', and the operator ``-and''
4389b50d902SRodney W. Grimeswas implemented as ``\-a''.
4399b50d902SRodney W. Grimes.Pp
4409b50d902SRodney W. GrimesHistoric implementations of the
4419b50d902SRodney W. Grimes.Ic exec
4429b50d902SRodney W. Grimesand
4439b50d902SRodney W. Grimes.Ic ok
4449b50d902SRodney W. Grimesprimaries did not replace the string ``{}'' in the utility name or the
4459b50d902SRodney W. Grimesutility arguments if it had preceding or following non-whitespace characters.
4469b50d902SRodney W. GrimesThis version replaces it no matter where in the utility name or arguments
4479b50d902SRodney W. Grimesit appears.
4489b50d902SRodney W. Grimes.Sh BUGS
4499b50d902SRodney W. GrimesThe special characters used by
4509b50d902SRodney W. Grimes.Nm find
4519b50d902SRodney W. Grimesare also special characters to many shell programs.
4529b50d902SRodney W. GrimesIn particular, the characters ``*'', ``['', ``]'', ``?'', ``('', ``)'',
4539b50d902SRodney W. Grimes``!'', ``\e'' and ``;'' may have to be escaped from the shell.
4549b50d902SRodney W. Grimes.Pp
4559b50d902SRodney W. GrimesAs there is no delimiter separating options and file names or file
4569b50d902SRodney W. Grimesnames and the
4579b50d902SRodney W. Grimes.Ar expression ,
4589b50d902SRodney W. Grimesit is difficult to specify files named ``-xdev'' or ``!''.
4599b50d902SRodney W. GrimesThese problems are handled by the
4609b50d902SRodney W. Grimes.Fl f
4619b50d902SRodney W. Grimesoption and the
4629b50d902SRodney W. Grimes.Xr getopt 3
4639b50d902SRodney W. Grimes``--'' construct.
464b8923d4cSWolfram Schneider.Sh HISTORY
465b8923d4cSWolfram SchneiderA
466b8923d4cSWolfram Schneider.Nm
467b8923d4cSWolfram Schneidercommand appeared in
468b8923d4cSWolfram Schneider.At v1 .
469