xref: /freebsd/usr.bin/find/find.1 (revision 5e25d888a82745e34d08c144060194297d79d750)
19b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
29b50d902SRodney W. Grimes.\"
39b50d902SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
49b50d902SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc.
59b50d902SRodney W. Grimes.\"
69b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
79b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
89b50d902SRodney W. Grimes.\" are met:
99b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
109b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
119b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
129b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
139b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
149b50d902SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
159b50d902SRodney W. Grimes.\"    must display the following acknowledgement:
169b50d902SRodney W. Grimes.\"	This product includes software developed by the University of
179b50d902SRodney W. Grimes.\"	California, Berkeley and its contributors.
189b50d902SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
199b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
209b50d902SRodney W. Grimes.\"    without specific prior written permission.
219b50d902SRodney W. Grimes.\"
229b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
239b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
249b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
259b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
269b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
279b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
289b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
299b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
309b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
319b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
329b50d902SRodney W. Grimes.\" SUCH DAMAGE.
339b50d902SRodney W. Grimes.\"
34841484cdSPeter Wemm.\"	@(#)find.1	8.7 (Berkeley) 5/9/95
35c3aac50fSPeter Wemm.\" $FreeBSD$
369b50d902SRodney W. Grimes.\"
37bfd12208SRuslan Ermilov.Dd May 3, 2001
389b50d902SRodney W. Grimes.Dt FIND 1
399b50d902SRodney W. Grimes.Os
409b50d902SRodney W. Grimes.Sh NAME
419b50d902SRodney W. Grimes.Nm find
429b50d902SRodney W. Grimes.Nd walk a file hierarchy
439b50d902SRodney W. Grimes.Sh SYNOPSIS
448fe908efSRuslan Ermilov.Nm
459b50d902SRodney W. Grimes.Op Fl H | Fl L | Fl P
467c1d4b3aSAkinori MUSHA.Op Fl EXdsx
470c101fb2SJoseph Koshy.Op Fl f Ar pathname
48bfd12208SRuslan Ermilov.Op Ar pathname ...
499b50d902SRodney W. Grimes.Ar expression
509b50d902SRodney W. Grimes.Sh DESCRIPTION
51e8937ba0SPhilippe CharnierThe
52e8937ba0SPhilippe Charnier.Nm
53e8937ba0SPhilippe Charnierutility recursively descends the directory tree for each
540c101fb2SJoseph Koshy.Ar pathname
559b50d902SRodney W. Grimeslisted, evaluating an
569b50d902SRodney W. Grimes.Ar expression
57bfd12208SRuslan Ermilov(composed of the
58bfd12208SRuslan Ermilov.Dq primaries
59bfd12208SRuslan Ermilovand
60bfd12208SRuslan Ermilov.Dq operands
61bfd12208SRuslan Ermilovlisted below) in terms
629b50d902SRodney W. Grimesof each file in the tree.
639b50d902SRodney W. Grimes.Pp
649b50d902SRodney W. GrimesThe options are as follows:
65bfd12208SRuslan Ermilov.Bl -tag -width indent
667c1d4b3aSAkinori MUSHA.It Fl E
677c1d4b3aSAkinori MUSHAInterpret regular expressions followed by
687c1d4b3aSAkinori MUSHA.Ic -regex
697c1d4b3aSAkinori MUSHAand
707c1d4b3aSAkinori MUSHA.Ic -iregex
717c1d4b3aSAkinori MUSHAoptions as extended (modern) regular expressions rather than basic
72bfd12208SRuslan Ermilovregular expressions (BRE's).
73bfd12208SRuslan ErmilovThe
747c1d4b3aSAkinori MUSHA.Xr re_format 7
757c1d4b3aSAkinori MUSHAmanual page fully describes both formats.
769b50d902SRodney W. Grimes.It Fl H
779b50d902SRodney W. GrimesThe
789b50d902SRodney W. Grimes.Fl H
799b50d902SRodney W. Grimesoption causes the file information and file type (see
809b50d902SRodney W. Grimes.Xr stat 2 )
819b50d902SRodney W. Grimesreturned for each symbolic link specified on the command line to be
829b50d902SRodney W. Grimesthose of the file referenced by the link, not the link itself.
839b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will
846df69548SBruce Evansbe for the link itself.
856df69548SBruce EvansFile information of all symbolic links not on
869b50d902SRodney W. Grimesthe command line is that of the link itself.
879b50d902SRodney W. Grimes.It Fl L
889b50d902SRodney W. GrimesThe
899b50d902SRodney W. Grimes.Fl L
909b50d902SRodney W. Grimesoption causes the file information and file type (see
919b50d902SRodney W. Grimes.Xr stat 2 )
929b50d902SRodney W. Grimesreturned for each symbolic link to be those of the file referenced by the
939b50d902SRodney W. Grimeslink, not the link itself.
949b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will
959b50d902SRodney W. Grimesbe for the link itself.
969b50d902SRodney W. Grimes.It Fl P
979b50d902SRodney W. GrimesThe
989b50d902SRodney W. Grimes.Fl P
999b50d902SRodney W. Grimesoption causes the file information and file type (see
1009b50d902SRodney W. Grimes.Xr stat 2 )
1019b50d902SRodney W. Grimesreturned for each symbolic link to be those of the link itself.
1023d9a9402SJohn PolstraThis is the default.
1039b50d902SRodney W. Grimes.It Fl X
1049b50d902SRodney W. GrimesThe
1059b50d902SRodney W. Grimes.Fl X
1069b50d902SRodney W. Grimesoption is a modification to permit
1079b50d902SRodney W. Grimes.Nm
1089b50d902SRodney W. Grimesto be safely used in conjunction with
1099b50d902SRodney W. Grimes.Xr xargs 1 .
1109b50d902SRodney W. GrimesIf a file name contains any of the delimiting characters used by
111bfd12208SRuslan Ermilov.Xr xargs 1 ,
1129b50d902SRodney W. Grimesa diagnostic message is displayed on standard error, and the file
1139b50d902SRodney W. Grimesis skipped.
114bfd12208SRuslan ErmilovThe delimiting characters include single
115bfd12208SRuslan Ermilov.Pq Dq Li " ' "
116bfd12208SRuslan Ermilovand double
117bfd12208SRuslan Ermilov.Pq Dq Li " \*q "
118bfd12208SRuslan Ermilovquotes, backslash
119bfd12208SRuslan Ermilov.Pq Dq Li \e ,
120bfd12208SRuslan Ermilovspace, tab and newline characters.
121a8d50686STom Rhodes.Pp
122a8d50686STom RhodesHowever, you may wish to consider the
123a8d50686STom Rhodes.Fl print0
124a8d50686STom Rhodesprimary in conjunction with
125e2f8ed51SRuslan Ermilov.Dq Nm xargs Fl 0
126a8d50686STom Rhodesas an effective alternative.
1279b50d902SRodney W. Grimes.It Fl d
1289b50d902SRodney W. GrimesThe
1299b50d902SRodney W. Grimes.Fl d
1309b50d902SRodney W. Grimesoption causes
1318fe908efSRuslan Ermilov.Nm
132bfd12208SRuslan Ermilovto perform a depth\-first traversal, i.e., directories
1339b50d902SRodney W. Grimesare visited in post\-order and all entries in a directory will be acted
1349b50d902SRodney W. Grimeson before the directory itself.
1359b50d902SRodney W. GrimesBy default,
1368fe908efSRuslan Ermilov.Nm
137bfd12208SRuslan Ermilovvisits directories in pre\-order, i.e., before their contents.
1389b50d902SRodney W. GrimesNote, the default is
139bfd12208SRuslan Ermilov.Em not
1409b50d902SRodney W. Grimesa breadth\-first traversal.
1419b50d902SRodney W. Grimes.It Fl f
1429b50d902SRodney W. GrimesThe
1439b50d902SRodney W. Grimes.Fl f
1449b50d902SRodney W. Grimesoption specifies a file hierarchy for
1458fe908efSRuslan Ermilov.Nm
1469b50d902SRodney W. Grimesto traverse.
1479b50d902SRodney W. GrimesFile hierarchies may also be specified as the operands immediately
1489b50d902SRodney W. Grimesfollowing the options.
1496d0c7e13SWolfram Schneider.It Fl s
1506d0c7e13SWolfram SchneiderThe
1516d0c7e13SWolfram Schneider.Fl s
1526df69548SBruce Evansoption causes
1538fe908efSRuslan Ermilov.Nm
1546df69548SBruce Evansto traverse the file hierarchies in lexicographical order,
1556df69548SBruce Evansi.e., alphabetical order within each directory.
1566df69548SBruce EvansNote:
157bfd12208SRuslan Ermilov.Ql find -s
1586d0c7e13SWolfram Schneiderand
159bfd12208SRuslan Ermilov.Ql "find | sort"
1606d0c7e13SWolfram Schneidermay give different results.
1619b50d902SRodney W. Grimes.It Fl x
1629b50d902SRodney W. GrimesThe
1639b50d902SRodney W. Grimes.Fl x
1649b50d902SRodney W. Grimesoption prevents
1658fe908efSRuslan Ermilov.Nm
1669b50d902SRodney W. Grimesfrom descending into directories that have a device number different
1679b50d902SRodney W. Grimesthan that of the file from which the descent began.
1689b50d902SRodney W. Grimes.El
1699b50d902SRodney W. Grimes.Sh PRIMARIES
170bfd12208SRuslan Ermilov.Bl -tag -width indent
1713f5223f8SWolfram Schneider.It Ic -amin Ar n
1723f5223f8SWolfram SchneiderTrue if the difference between the file last access time and the time
1738fe908efSRuslan Ermilov.Nm
17445fe9882SMatthew Huntwas started, rounded up to the next full minute, is
1753f5223f8SWolfram Schneider.Ar n
17645fe9882SMatthew Huntminutes.
177ea92232aSPoul-Henning Kamp.It Ic -anewer Ar file
178ea92232aSPoul-Henning KampSame as
179ea92232aSPoul-Henning Kamp.Ic -neweram .
180adff4fcaSRuslan Ermilov.It Ic -atime Ar n Ns Op Cm smhdw
181adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to
182adff4fcaSRuslan Ermilovtrue if the difference between the file last access time and the time
1838fe908efSRuslan Ermilov.Nm
1849b50d902SRodney W. Grimeswas started, rounded up to the next full 24\-hour period, is
1859b50d902SRodney W. Grimes.Ar n
1869b50d902SRodney W. Grimes24\-hour periods.
187adff4fcaSRuslan Ermilov.Pp
188adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to
189adff4fcaSRuslan Ermilovtrue if the difference between the file last access time and the time
190adff4fcaSRuslan Ermilov.Nm
191adff4fcaSRuslan Ermilovwas started is exactly
192adff4fcaSRuslan Ermilov.Ar n
193adff4fcaSRuslan Ermilovunits.
194adff4fcaSRuslan ErmilovPossible time units are as follows:
195adff4fcaSRuslan Ermilov.Pp
196adff4fcaSRuslan Ermilov.Bl -tag -width indent -compact
197adff4fcaSRuslan Ermilov.It Cm s
198adff4fcaSRuslan Ermilovsecond
199adff4fcaSRuslan Ermilov.It Cm m
200adff4fcaSRuslan Ermilovminute (60 seconds)
201adff4fcaSRuslan Ermilov.It Cm h
202adff4fcaSRuslan Ermilovhour (60 minutes)
203adff4fcaSRuslan Ermilov.It Cm d
204adff4fcaSRuslan Ermilovday (24 hours)
205adff4fcaSRuslan Ermilov.It Cm w
206adff4fcaSRuslan Ermilovweek (7 days)
207adff4fcaSRuslan Ermilov.El
208adff4fcaSRuslan Ermilov.Pp
209adff4fcaSRuslan ErmilovAny number of units may be combined in one
210adff4fcaSRuslan Ermilov.Ic -atime
211adff4fcaSRuslan Ermilovargument, for example,
212adff4fcaSRuslan Ermilov.Dq Li "-atime -1h30m" .
213adff4fcaSRuslan ErmilovUnits are probably only useful when used in conjunction with the
214adff4fcaSRuslan Ermilov.Cm +
215adff4fcaSRuslan Ermilovor
216adff4fcaSRuslan Ermilov.Cm -
217adff4fcaSRuslan Ermilovmodifier.
2183f5223f8SWolfram Schneider.It Ic -cmin Ar n
2193f5223f8SWolfram SchneiderTrue if the difference between the time of last change of file status
2203f5223f8SWolfram Schneiderinformation and the time
2218fe908efSRuslan Ermilov.Nm
22245fe9882SMatthew Huntwas started, rounded up to the next full minute, is
2233f5223f8SWolfram Schneider.Ar n
22445fe9882SMatthew Huntminutes.
225ea92232aSPoul-Henning Kamp.It Ic -cnewer Ar file
226ea92232aSPoul-Henning KampSame as
227ea92232aSPoul-Henning Kamp.Ic -newercm .
228adff4fcaSRuslan Ermilov.It Ic -ctime Ar n Ns Op Cm smhdw
229adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to
230adff4fcaSRuslan Ermilovtrue if the difference between the time of last change of file status
2319b50d902SRodney W. Grimesinformation and the time
2328fe908efSRuslan Ermilov.Nm
2339b50d902SRodney W. Grimeswas started, rounded up to the next full 24\-hour period, is
2349b50d902SRodney W. Grimes.Ar n
2359b50d902SRodney W. Grimes24\-hour periods.
236adff4fcaSRuslan Ermilov.Pp
237adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to
238adff4fcaSRuslan Ermilovtrue if the difference between the time of last change of file status
239adff4fcaSRuslan Ermilovinformation and the time
240adff4fcaSRuslan Ermilov.Nm
241adff4fcaSRuslan Ermilovwas started is exactly
242adff4fcaSRuslan Ermilov.Ar n
243adff4fcaSRuslan Ermilovunits.
244adff4fcaSRuslan ErmilovPlease refer to the
245adff4fcaSRuslan Ermilov.Ic -atime
246adff4fcaSRuslan Ermilovprimary description for information on supported time units.
247abacbbbfSPeter Wemm.It Ic -delete
2486df69548SBruce EvansDelete found files and/or directories.
2496df69548SBruce EvansAlways returns true.
2506df69548SBruce EvansThis executes
251abacbbbfSPeter Wemmfrom the current working directory as
252abacbbbfSPeter Wemm.Nm
2536df69548SBruce Evansrecurses down the tree.
254bfd12208SRuslan ErmilovIt will not attempt to delete a filename with a
255bfd12208SRuslan Ermilov.Dq Pa /
256bfd12208SRuslan Ermilovcharacter in its pathname relative to
257bfd12208SRuslan Ermilov.Dq Pa \&.
258bfd12208SRuslan Ermilovfor security reasons.
259abacbbbfSPeter WemmDepth\-first traversal processing is implied by this option.
2609b4e871aSDavid E. O'Brien.It Ic -depth
2619b4e871aSDavid E. O'BrienAlways true;
2629b4e871aSDavid E. O'Briensame as the
2639b4e871aSDavid E. O'Brien.Fl d
2649b4e871aSDavid E. O'Brienoption.
2659b4e871aSDavid E. O'Brien.Ic -depth
2669b4e871aSDavid E. O'Briencan be useful when
2679b4e871aSDavid E. O'Brien.Nm
2689b4e871aSDavid E. O'Brienis used with
2699b4e871aSDavid E. O'Brien.Xr cpio 1
2709b4e871aSDavid E. O'Briento process files that are contained in directories with unusual permissions.
2717e7f3df6SGiorgos KeramidasIt ensures that you have write permission while you are placing files in a
272d33321c0SRuslan Ermilovdirectory, then sets the directory's permissions as the last thing.
273ed1a4621SPeter Wemm.It Ic -empty
274ed1a4621SPeter WemmTrue if the current file or directory is empty.
275bfd12208SRuslan Ermilov.It Ic -exec Ar utility Op Ar argument ... ;
2769b50d902SRodney W. GrimesTrue if the program named
2779b50d902SRodney W. Grimes.Ar utility
2789b50d902SRodney W. Grimesreturns a zero value as its exit status.
279bfd12208SRuslan ErmilovOptional
280bfd12208SRuslan Ermilov.Ar arguments
281bfd12208SRuslan Ermilovmay be passed to the utility.
282bfd12208SRuslan ErmilovThe expression must be terminated by a semicolon
283bfd12208SRuslan Ermilov.Pq Dq Li \&; .
284bfd12208SRuslan ErmilovIf the string
285bfd12208SRuslan Ermilov.Dq Li {}
286bfd12208SRuslan Ermilovappears anywhere in the utility name or the
2879b50d902SRodney W. Grimesarguments it is replaced by the pathname of the current file.
2889b50d902SRodney W. Grimes.Ar Utility
2899b50d902SRodney W. Grimeswill be executed from the directory from which
2908fe908efSRuslan Ermilov.Nm
2919b50d902SRodney W. Grimeswas executed.
29208274979SYaroslav Tykhiy.Ar Utility
29308274979SYaroslav Tykhiyand
29408274979SYaroslav Tykhiy.Ar arguments
29508274979SYaroslav Tykhiyare not subject to the further expansion of shell patterns
29608274979SYaroslav Tykhiyand constructs.
2975e25d888STim J. Robbins.It Ic -exec Ar utility Oo Ar argument ... Oc {} +
2985e25d888STim J. RobbinsSame as
2995e25d888STim J. Robbins.Ic -exec ,
3005e25d888STim J. Robbinsexcept that
3015e25d888STim J. Robbins.Dq Li {}
3025e25d888STim J. Robbinsis replaced with as many pathnames as possible for each invocation of
3035e25d888STim J. Robbins.Ar utility .
3045e25d888STim J. RobbinsThis behaviour is similar to that of
3055e25d888STim J. Robbins.Xr xargs 1 .
306bfd12208SRuslan Ermilov.It Ic -execdir Ar utility Op Ar argument ... ;
307127d7563SWarner LoshThe
308bfd12208SRuslan Ermilov.Ic -execdir
309127d7563SWarner Loshprimary is identical to the
310127d7563SWarner Losh.Ic -exec
311127d7563SWarner Loshprimary with the exception that
312bfd12208SRuslan Ermilov.Ar utility
313127d7563SWarner Loshwill be executed from the directory that holds
3146df69548SBruce Evansthe current file.
3156df69548SBruce EvansThe filename substituted for
316bfd12208SRuslan Ermilovthe string
317bfd12208SRuslan Ermilov.Dq Li {}
318bfd12208SRuslan Ermilovis not qualified.
3197fd5ee41SRuslan Ermilov.It Ic -flags Oo Cm - Ns | Ns Cm + Oc Ns Ar flags , Ns Ar notflags
3207fd5ee41SRuslan ErmilovThe flags are specified using symbolic names (see
321208691fcSRuslan Ermilov.Xr chflags 1 ) .
3227fd5ee41SRuslan ErmilovThose with the
3237fd5ee41SRuslan Ermilov.Qq Li no
3247fd5ee41SRuslan Ermilovprefix (except
3257fd5ee41SRuslan Ermilov.Qq Li nodump )
3267fd5ee41SRuslan Ermilovare said to be
3277fd5ee41SRuslan Ermilov.Ar notflags .
3287fd5ee41SRuslan ErmilovFlags in
3297fd5ee41SRuslan Ermilov.Ar flags
3307fd5ee41SRuslan Ermilovare checked to be set, and flags in
3317fd5ee41SRuslan Ermilov.Ar notflags
3327fd5ee41SRuslan Ermilovare checked to be not set.
333208691fcSRuslan ErmilovNote that this is different from
334208691fcSRuslan Ermilov.Ic -perm ,
3357fd5ee41SRuslan Ermilovwhich only allows the user to specify mode bits that are set.
3367fd5ee41SRuslan Ermilov.Pp
3377fd5ee41SRuslan ErmilovIf flags are preceded by a dash
3387fd5ee41SRuslan Ermilov.Pq Dq Li - ,
3397fd5ee41SRuslan Ermilovthis primary evaluates to true
3407fd5ee41SRuslan Ermilovif at least all of the bits in
3417fd5ee41SRuslan Ermilov.Ar flags
3427fd5ee41SRuslan Ermilovand none of the bits in
3437fd5ee41SRuslan Ermilov.Ar notflags
3447fd5ee41SRuslan Ermilovare set in the file's flags bits.
3457fd5ee41SRuslan ErmilovIf flags are preceded by a plus
3467fd5ee41SRuslan Ermilov.Pq Dq Li + ,
3477fd5ee41SRuslan Ermilovthis primary evaluates to true
3487fd5ee41SRuslan Ermilovif any of the bits in
3497fd5ee41SRuslan Ermilov.Ar flags
3507fd5ee41SRuslan Ermilovis set in the file's flags bits,
3517fd5ee41SRuslan Ermilovor any of the bits in
3527fd5ee41SRuslan Ermilov.Ar notflags
3537fd5ee41SRuslan Ermilovis not set in the file's flags bits.
3547fd5ee41SRuslan ErmilovOtherwise,
3557fd5ee41SRuslan Ermilovthis primary evaluates to true
3567fd5ee41SRuslan Ermilovif the bits in
3577fd5ee41SRuslan Ermilov.Ar flags
3587fd5ee41SRuslan Ermilovexactly match the file's flags bits,
3597fd5ee41SRuslan Ermilovand none of the
3607fd5ee41SRuslan Ermilov.Ar flags
3617fd5ee41SRuslan Ermilovbits match those of
3627fd5ee41SRuslan Ermilov.Ar notflags .
3639b50d902SRodney W. Grimes.It Ic -fstype Ar type
3649b50d902SRodney W. GrimesTrue if the file is contained in a filesystem of type
3659b50d902SRodney W. Grimes.Ar type .
366841484cdSPeter WemmThe
367841484cdSPeter Wemm.Xr sysctl 8
368841484cdSPeter Wemmcommand can be used to find out the types of filesystems
369841484cdSPeter Wemmthat are available on the system:
370bfd12208SRuslan Ermilov.Pp
371bfd12208SRuslan Ermilov.Dl "sysctl vfs"
372bfd12208SRuslan Ermilov.Pp
373bfd12208SRuslan ErmilovIn addition, there are two pseudo-types,
374bfd12208SRuslan Ermilov.Dq Li local
375bfd12208SRuslan Ermilovand
376bfd12208SRuslan Ermilov.Dq Li rdonly .
3779b50d902SRodney W. GrimesThe former matches any filesystem physically mounted on the system where
3789b50d902SRodney W. Grimesthe
3798fe908efSRuslan Ermilov.Nm
3809b50d902SRodney W. Grimesis being executed and the latter matches any filesystem which is
3819b50d902SRodney W. Grimesmounted read-only.
3829b50d902SRodney W. Grimes.It Ic -group Ar gname
3839b50d902SRodney W. GrimesTrue if the file belongs to the group
3849b50d902SRodney W. Grimes.Ar gname .
3859b50d902SRodney W. GrimesIf
3869b50d902SRodney W. Grimes.Ar gname
3879b50d902SRodney W. Grimesis numeric and there is no such group name, then
3889b50d902SRodney W. Grimes.Ar gname
389bfd12208SRuslan Ermilovis treated as a group ID.
390208691fcSRuslan Ermilov.It Ic -iname Ar pattern
391208691fcSRuslan ErmilovLike
392208691fcSRuslan Ermilov.Ic -name ,
393208691fcSRuslan Ermilovbut the match is case insensitive.
3949b50d902SRodney W. Grimes.It Ic -inum Ar n
3959b50d902SRodney W. GrimesTrue if the file has inode number
3969b50d902SRodney W. Grimes.Ar n .
397208691fcSRuslan Ermilov.It Ic -ipath Ar pattern
398208691fcSRuslan ErmilovLike
399208691fcSRuslan Ermilov.Ic -path ,
400208691fcSRuslan Ermilovbut the match is case insensitive.
401208691fcSRuslan Ermilov.It Ic -iregex Ar pattern
402208691fcSRuslan ErmilovLike
403208691fcSRuslan Ermilov.Ic -regex ,
404208691fcSRuslan Ermilovbut the match is case insensitive.
4059b50d902SRodney W. Grimes.It Ic -links Ar n
4069b50d902SRodney W. GrimesTrue if the file has
4079b50d902SRodney W. Grimes.Ar n
4089b50d902SRodney W. Grimeslinks.
4099b50d902SRodney W. Grimes.It Ic -ls
4109b50d902SRodney W. GrimesThis primary always evaluates to true.
4119b50d902SRodney W. GrimesThe following information for the current file is written to standard output:
4129b50d902SRodney W. Grimesits inode number, size in 512\-byte blocks, file permissions, number of hard
4139b50d902SRodney W. Grimeslinks, owner, group, size in bytes, last modification time, and pathname.
4149b50d902SRodney W. GrimesIf the file is a block or character special file, the major and minor numbers
4159b50d902SRodney W. Grimeswill be displayed instead of the size in bytes.
4169b50d902SRodney W. GrimesIf the file is a symbolic link, the pathname of the linked\-to file will be
417bfd12208SRuslan Ermilovdisplayed preceded by
418bfd12208SRuslan Ermilov.Dq Li -> .
419bfd12208SRuslan ErmilovThe format is identical to that produced by
420bfd12208SRuslan Ermilov.Bk -words
421bfd12208SRuslan Ermilov.Nm ls Fl dgils .
422bfd12208SRuslan Ermilov.Ek
423c76bc8f3SOllivier Robert.It Ic -maxdepth Ar n
424c76bc8f3SOllivier RobertTrue if the depth of the current file into the tree is less than or equal to
425c76bc8f3SOllivier Robert.Ar n .
426c76bc8f3SOllivier Robert.It Ic -mindepth Ar n
427c76bc8f3SOllivier RobertTrue if the depth of the current file into the tree is greater than or equal to
428c76bc8f3SOllivier Robert.Ar n .
4293f5223f8SWolfram Schneider.It Ic -mmin Ar n
4303f5223f8SWolfram SchneiderTrue if the difference between the file last modification time and the time
4318fe908efSRuslan Ermilov.Nm
43245fe9882SMatthew Huntwas started, rounded up to the next full minute, is
4333f5223f8SWolfram Schneider.Ar n
43445fe9882SMatthew Huntminutes.
435208691fcSRuslan Ermilov.It Ic -mnewer Ar file
436208691fcSRuslan ErmilovSame as
437208691fcSRuslan Ermilov.Ic -newer .
438adff4fcaSRuslan Ermilov.It Ic -mtime Ar n Ns Op Cm smhdw
439adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to
440adff4fcaSRuslan Ermilovtrue if the difference between the file last modification time and the time
4418fe908efSRuslan Ermilov.Nm
4429b50d902SRodney W. Grimeswas started, rounded up to the next full 24\-hour period, is
4439b50d902SRodney W. Grimes.Ar n
4449b50d902SRodney W. Grimes24\-hour periods.
445adff4fcaSRuslan Ermilov.Pp
446adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to
447adff4fcaSRuslan Ermilovtrue if the difference between the file last modification time and the time
448adff4fcaSRuslan Ermilov.Nm
449adff4fcaSRuslan Ermilovwas started is exactly
450adff4fcaSRuslan Ermilov.Ar n
451adff4fcaSRuslan Ermilovunits.
452adff4fcaSRuslan ErmilovPlease refer to the
453adff4fcaSRuslan Ermilov.Ic -atime
454adff4fcaSRuslan Ermilovprimary description for information on supported time units.
4559b50d902SRodney W. Grimes.It Ic -name Ar pattern
4569b50d902SRodney W. GrimesTrue if the last component of the pathname being examined matches
4579b50d902SRodney W. Grimes.Ar pattern .
458bfd12208SRuslan ErmilovSpecial shell pattern matching characters
459bfd12208SRuslan Ermilov.Dq ( Li \&[ ,
460bfd12208SRuslan Ermilov.Dq Li \&] ,
461bfd12208SRuslan Ermilov.Dq Li * ,
462bfd12208SRuslan Ermilovand
463bfd12208SRuslan Ermilov.Dq Li \&? )
4649b50d902SRodney W. Grimesmay be used as part of
4659b50d902SRodney W. Grimes.Ar pattern .
4669b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a
467bfd12208SRuslan Ermilovbackslash
468bfd12208SRuslan Ermilov.Pq Dq Li \e .
4699b50d902SRodney W. Grimes.It Ic -newer Ar file
4709b50d902SRodney W. GrimesTrue if the current file has a more recent last modification time than
4719b50d902SRodney W. Grimes.Ar file .
472bfd12208SRuslan Ermilov.It Ic -newer Ns Ar X Ns Ar Y Ar file
473bfd12208SRuslan ErmilovTrue if the current file has a more recent last access time
474bfd12208SRuslan Ermilov.Ar ( X Ns = Ns Cm a ) ,
475bfd12208SRuslan Ermilovchange time
476bfd12208SRuslan Ermilov.Ar ( X Ns = Ns Cm c ) ,
477bfd12208SRuslan Ermilovor modification time
478bfd12208SRuslan Ermilov.Ar ( X Ns = Ns Cm m )
479bfd12208SRuslan Ermilovthan the last access time
480bfd12208SRuslan Ermilov.Ar ( Y Ns = Ns Cm a ) ,
481bfd12208SRuslan Ermilovchange time
482bfd12208SRuslan Ermilov.Ar ( Y Ns = Ns Cm c ) ,
483bfd12208SRuslan Ermilovor modification time
484bfd12208SRuslan Ermilov.Ar ( Y Ns = Ns Cm m )
485bfd12208SRuslan Ermilovof
486ea92232aSPoul-Henning Kamp.Ar file .
487ea92232aSPoul-Henning KampIn addition, if
488bfd12208SRuslan Ermilov.Ar Y Ns = Ns Cm t ,
489ea92232aSPoul-Henning Kampthen
490ea92232aSPoul-Henning Kamp.Ar file
491ea92232aSPoul-Henning Kampis instead interpreted as a direct date specification of the form
492ea92232aSPoul-Henning Kampunderstood by
493ea92232aSPoul-Henning Kamp.Xr cvs 1 .
494ea92232aSPoul-Henning KampNote that
495ea92232aSPoul-Henning Kamp.Ic -newermm
496ea92232aSPoul-Henning Kampis equivalent to
497ea92232aSPoul-Henning Kamp.Ic -newer .
4989b50d902SRodney W. Grimes.It Ic -nogroup
4999b50d902SRodney W. GrimesTrue if the file belongs to an unknown group.
500208691fcSRuslan Ermilov.It Ic -nouser
501208691fcSRuslan ErmilovTrue if the file belongs to an unknown user.
502208691fcSRuslan Ermilov.It Ic -ok Ar utility Op Ar argument ... ;
503208691fcSRuslan ErmilovThe
504208691fcSRuslan Ermilov.Ic -ok
505208691fcSRuslan Ermilovprimary is identical to the
506208691fcSRuslan Ermilov.Ic -exec
507208691fcSRuslan Ermilovprimary with the exception that
508208691fcSRuslan Ermilov.Nm
509208691fcSRuslan Ermilovrequests user affirmation for the execution of the
510208691fcSRuslan Ermilov.Ar utility
511208691fcSRuslan Ermilovby printing
512208691fcSRuslan Ermilova message to the terminal and reading a response.
513208691fcSRuslan ErmilovIf the response is other than
514208691fcSRuslan Ermilov.Dq Li y
515208691fcSRuslan Ermilovthe command is not executed and the
516208691fcSRuslan Ermilovvalue of the
517208691fcSRuslan Ermilov.Ic -ok
518208691fcSRuslan Ermilovexpression is false.
519208691fcSRuslan Ermilov.It Ic -okdir Ar utility Op Ar argument ... ;
520208691fcSRuslan ErmilovThe
521208691fcSRuslan Ermilov.Ic -okdir
522208691fcSRuslan Ermilovprimary is identical to the
523208691fcSRuslan Ermilov.Ic -execdir
524208691fcSRuslan Ermilovprimary with the same exception as described for the
525208691fcSRuslan Ermilov.Ic -ok
526208691fcSRuslan Ermilovprimary.
5279b50d902SRodney W. Grimes.It Ic -path Ar pattern
5289b50d902SRodney W. GrimesTrue if the pathname being examined matches
5299b50d902SRodney W. Grimes.Ar pattern .
530bfd12208SRuslan ErmilovSpecial shell pattern matching characters
531bfd12208SRuslan Ermilov.Dq ( Li \&[ ,
532bfd12208SRuslan Ermilov.Dq Li \&] ,
533bfd12208SRuslan Ermilov.Dq Li * ,
534bfd12208SRuslan Ermilovand
535bfd12208SRuslan Ermilov.Dq Li \&? )
5369b50d902SRodney W. Grimesmay be used as part of
5379b50d902SRodney W. Grimes.Ar pattern .
5389b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a
539bfd12208SRuslan Ermilovbackslash
540bfd12208SRuslan Ermilov.Pq Dq Li \e .
541bfd12208SRuslan ErmilovSlashes
542bfd12208SRuslan Ermilov.Pq Dq Li /
543bfd12208SRuslan Ermilovare treated as normal characters and do not have to be
5449b50d902SRodney W. Grimesmatched explicitly.
5457fd5ee41SRuslan Ermilov.It Ic -perm Oo Cm - Ns | Ns Cm + Oc Ns Ar mode
5469b50d902SRodney W. GrimesThe
5479b50d902SRodney W. Grimes.Ar mode
5489b50d902SRodney W. Grimesmay be either symbolic (see
5499b50d902SRodney W. Grimes.Xr chmod 1 )
5509b50d902SRodney W. Grimesor an octal number.
5517fd5ee41SRuslan ErmilovIf the
5527fd5ee41SRuslan Ermilov.Ar mode
5537fd5ee41SRuslan Ermilovis symbolic, a starting value of zero is assumed and the
5547fd5ee41SRuslan Ermilov.Ar mode
5557fd5ee41SRuslan Ermilovsets or clears permissions without regard to the process' file mode
5569b50d902SRodney W. Grimescreation mask.
5577fd5ee41SRuslan ErmilovIf the
5587fd5ee41SRuslan Ermilov.Ar mode
5597fd5ee41SRuslan Ermilovis octal, only bits 07777
560bfd12208SRuslan Ermilov.Pq Dv S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO
5619b50d902SRodney W. Grimesof the file's mode bits participate
5629b50d902SRodney W. Grimesin the comparison.
5637fd5ee41SRuslan ErmilovIf the
5647fd5ee41SRuslan Ermilov.Ar mode
5657fd5ee41SRuslan Ermilovis preceded by a dash
566bfd12208SRuslan Ermilov.Pq Dq Li - ,
5679b88faecSRuslan Ermilovthis primary evaluates to true
5687fd5ee41SRuslan Ermilovif at least all of the bits in the
5697fd5ee41SRuslan Ermilov.Ar mode
5707fd5ee41SRuslan Ermilovare set in the file's mode bits.
5717fd5ee41SRuslan ErmilovIf the
5727fd5ee41SRuslan Ermilov.Ar mode
5737fd5ee41SRuslan Ermilovis preceded by a plus
574bfd12208SRuslan Ermilov.Pq Dq Li + ,
5759b88faecSRuslan Ermilovthis primary evaluates to true
5767fd5ee41SRuslan Ermilovif any of the bits in the
5777fd5ee41SRuslan Ermilov.Ar mode
5787fd5ee41SRuslan Ermilovare set in the file's mode bits.
5799d2796c3SOllivier RobertOtherwise, this primary evaluates to true if
5807fd5ee41SRuslan Ermilovthe bits in the
5817fd5ee41SRuslan Ermilov.Ar mode
5827fd5ee41SRuslan Ermilovexactly match the file's mode bits.
583bfd12208SRuslan ErmilovNote, the first character of a symbolic mode may not be a dash
584bfd12208SRuslan Ermilov.Pq Dq Li - .
5859b50d902SRodney W. Grimes.It Ic -print
5869b50d902SRodney W. GrimesThis primary always evaluates to true.
5879b50d902SRodney W. GrimesIt prints the pathname of the current file to standard output.
588841484cdSPeter WemmIf none of
589bfd12208SRuslan Ermilov.Ic -exec , -ls , -print0 ,
5909b50d902SRodney W. Grimesor
591bfd12208SRuslan Ermilov.Ic -ok
592841484cdSPeter Wemmis specified, the given expression shall be effectively replaced by
593bfd12208SRuslan Ermilov.Cm \&( Ar "given expression" Cm \&) Ic -print .
5947cd23434SGarrett Wollman.It Ic -print0
5957cd23434SGarrett WollmanThis primary always evaluates to true.
596fbe0d04aSMasafumi Max NAKANEIt prints the pathname of the current file to standard output, followed by an
597bfd12208SRuslan Ermilov.Tn ASCII NUL
5987cd23434SGarrett Wollmancharacter (character code 0).
5999b50d902SRodney W. Grimes.It Ic -prune
6009b50d902SRodney W. GrimesThis primary always evaluates to true.
6019b50d902SRodney W. GrimesIt causes
6028fe908efSRuslan Ermilov.Nm
6039b50d902SRodney W. Grimesto not descend into the current file.
6049b50d902SRodney W. GrimesNote, the
6059b50d902SRodney W. Grimes.Ic -prune
6069b50d902SRodney W. Grimesprimary has no effect if the
6079b50d902SRodney W. Grimes.Fl d
6089b50d902SRodney W. Grimesoption was specified.
609208691fcSRuslan Ermilov.It Ic -regex Ar pattern
610208691fcSRuslan ErmilovTrue if the whole path of the file matches
611208691fcSRuslan Ermilov.Ar pattern
612208691fcSRuslan Ermilovusing regular expression.
613208691fcSRuslan ErmilovTo match a file named
614208691fcSRuslan Ermilov.Dq Pa ./foo/xyzzy ,
615208691fcSRuslan Ermilovyou can use the regular expression
616208691fcSRuslan Ermilov.Dq Li ".*/[xyz]*"
617208691fcSRuslan Ermilovor
618208691fcSRuslan Ermilov.Dq Li ".*/foo/.*" ,
619208691fcSRuslan Ermilovbut not
620208691fcSRuslan Ermilov.Dq Li xyzzy
621208691fcSRuslan Ermilovor
622208691fcSRuslan Ermilov.Dq Li /foo/ .
6239b50d902SRodney W. Grimes.It Ic -size Ar n Ns Op Cm c
6249b50d902SRodney W. GrimesTrue if the file's size, rounded up, in 512\-byte blocks is
6259b50d902SRodney W. Grimes.Ar n .
6269b50d902SRodney W. GrimesIf
6279b50d902SRodney W. Grimes.Ar n
628bfd12208SRuslan Ermilovis followed by a
629bfd12208SRuslan Ermilov.Cm c ,
630bfd12208SRuslan Ermilovthen the primary is true if the
6319b50d902SRodney W. Grimesfile's size is
6329b50d902SRodney W. Grimes.Ar n
633bfd12208SRuslan Ermilovbytes (characters).
6349b50d902SRodney W. Grimes.It Ic -type Ar t
6359b50d902SRodney W. GrimesTrue if the file is of the specified type.
6369b50d902SRodney W. GrimesPossible file types are as follows:
6379b50d902SRodney W. Grimes.Pp
638bfd12208SRuslan Ermilov.Bl -tag -width indent -compact
6399b50d902SRodney W. Grimes.It Cm b
6409b50d902SRodney W. Grimesblock special
6419b50d902SRodney W. Grimes.It Cm c
6429b50d902SRodney W. Grimescharacter special
6439b50d902SRodney W. Grimes.It Cm d
6449b50d902SRodney W. Grimesdirectory
6459b50d902SRodney W. Grimes.It Cm f
6469b50d902SRodney W. Grimesregular file
6479b50d902SRodney W. Grimes.It Cm l
6489b50d902SRodney W. Grimessymbolic link
6499b50d902SRodney W. Grimes.It Cm p
6509b50d902SRodney W. GrimesFIFO
6519b50d902SRodney W. Grimes.It Cm s
6529b50d902SRodney W. Grimessocket
6539b50d902SRodney W. Grimes.El
6549b50d902SRodney W. Grimes.It Ic -user Ar uname
6559b50d902SRodney W. GrimesTrue if the file belongs to the user
6569b50d902SRodney W. Grimes.Ar uname .
6579b50d902SRodney W. GrimesIf
6589b50d902SRodney W. Grimes.Ar uname
6599b50d902SRodney W. Grimesis numeric and there is no such user name, then
6609b50d902SRodney W. Grimes.Ar uname
661bfd12208SRuslan Ermilovis treated as a user ID.
6629b50d902SRodney W. Grimes.El
6639b50d902SRodney W. Grimes.Pp
6649b50d902SRodney W. GrimesAll primaries which take a numeric argument allow the number to be
6659b88faecSRuslan Ermilovpreceded by a plus sign
666bfd12208SRuslan Ermilov.Pq Dq Li +
6679b88faecSRuslan Ermilovor a minus sign
668bfd12208SRuslan Ermilov.Pq Dq Li - .
669bfd12208SRuslan ErmilovA preceding plus sign means
670bfd12208SRuslan Ermilov.Dq more than n ,
671bfd12208SRuslan Ermilova preceding minus sign means
672bfd12208SRuslan Ermilov.Dq less than n
673bfd12208SRuslan Ermilovand neither means
674bfd12208SRuslan Ermilov.Dq exactly n .
6759b50d902SRodney W. Grimes.Sh OPERATORS
6769b50d902SRodney W. GrimesThe primaries may be combined using the following operators.
6779b50d902SRodney W. GrimesThe operators are listed in order of decreasing precedence.
678bfd12208SRuslan Ermilov.Pp
679bfd12208SRuslan Ermilov.Bl -tag -width "( expression )" -compact
6800c101fb2SJoseph Koshy.It Cm \&( Ar expression Cm \&)
6819b50d902SRodney W. GrimesThis evaluates to true if the parenthesized expression evaluates to
6829b50d902SRodney W. Grimestrue.
6839b50d902SRodney W. Grimes.Pp
6840c101fb2SJoseph Koshy.It Cm \&! Ar expression
6859b50d902SRodney W. GrimesThis is the unary
6869b50d902SRodney W. Grimes.Tn NOT
6879b50d902SRodney W. Grimesoperator.
6889b50d902SRodney W. GrimesIt evaluates to true if the expression is false.
6899b50d902SRodney W. Grimes.Pp
6909b50d902SRodney W. Grimes.It Ar expression Cm -and Ar expression
6919b50d902SRodney W. Grimes.It Ar expression expression
6929b50d902SRodney W. GrimesThe
6939b50d902SRodney W. Grimes.Cm -and
6949b50d902SRodney W. Grimesoperator is the logical
6959b50d902SRodney W. Grimes.Tn AND
6969b50d902SRodney W. Grimesoperator.
6979b50d902SRodney W. GrimesAs it is implied by the juxtaposition of two expressions it does not
6989b50d902SRodney W. Grimeshave to be specified.
6999b50d902SRodney W. GrimesThe expression evaluates to true if both expressions are true.
7009b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is false.
7019b50d902SRodney W. Grimes.Pp
7029b50d902SRodney W. Grimes.It Ar expression Cm -or Ar expression
7039b50d902SRodney W. GrimesThe
7049b50d902SRodney W. Grimes.Cm -or
7059b50d902SRodney W. Grimesoperator is the logical
7069b50d902SRodney W. Grimes.Tn OR
7079b50d902SRodney W. Grimesoperator.
7089b50d902SRodney W. GrimesThe expression evaluates to true if either the first or the second expression
7099b50d902SRodney W. Grimesis true.
7109b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is true.
7119b50d902SRodney W. Grimes.El
7129b50d902SRodney W. Grimes.Pp
7139b50d902SRodney W. GrimesAll operands and primaries must be separate arguments to
7148fe908efSRuslan Ermilov.Nm .
7159b50d902SRodney W. GrimesPrimaries which themselves take arguments expect each argument
7169b50d902SRodney W. Grimesto be a separate argument to
7178fe908efSRuslan Ermilov.Nm .
7189b50d902SRodney W. Grimes.Sh EXAMPLES
7199b50d902SRodney W. GrimesThe following examples are shown as given to the shell:
720bfd12208SRuslan Ermilov.Bl -tag -width indent
7219b50d902SRodney W. Grimes.It Li "find / \e! -name \*q*.c\*q -print"
722bfd12208SRuslan ErmilovPrint out a list of all the files whose names do not end in
723bfd12208SRuslan Ermilov.Pa .c .
7249b50d902SRodney W. Grimes.It Li "find / -newer ttt -user wnj -print"
725bfd12208SRuslan ErmilovPrint out a list of all the files owned by user
726bfd12208SRuslan Ermilov.Dq wnj
727bfd12208SRuslan Ermilovthat are newer
728bfd12208SRuslan Ermilovthan the file
729bfd12208SRuslan Ermilov.Pa ttt .
7309b50d902SRodney W. Grimes.It Li "find / \e! \e( -newer ttt -user wnj \e) -print"
731bfd12208SRuslan ErmilovPrint out a list of all the files which are not both newer than
732bfd12208SRuslan Ermilov.Pa ttt
733bfd12208SRuslan Ermilovand owned by
734bfd12208SRuslan Ermilov.Dq wnj .
7359b50d902SRodney W. Grimes.It Li "find / \e( -newer ttt -or -user wnj \e) -print"
736bfd12208SRuslan ErmilovPrint out a list of all the files that are either owned by
737bfd12208SRuslan Ermilov.Dq wnj
738bfd12208SRuslan Ermilovor that are newer than
739bfd12208SRuslan Ermilov.Pa ttt .
740ea92232aSPoul-Henning Kamp.It Li "find . -newerct '1 minute ago' -print"
741ea92232aSPoul-Henning KampPrint out a list of all the files whose inode change time is more
742ea92232aSPoul-Henning Kamprecent than the current time minus one minute.
7439b50d902SRodney W. Grimes.El
7449b50d902SRodney W. Grimes.Sh SEE ALSO
745567664c4SOllivier Robert.Xr chflags 1 ,
7469b50d902SRodney W. Grimes.Xr chmod 1 ,
747ea92232aSPoul-Henning Kamp.Xr cvs 1 ,
7489b50d902SRodney W. Grimes.Xr locate 1 ,
74941cbb624SJoseph Koshy.Xr whereis 1 ,
75041cbb624SJoseph Koshy.Xr which 1 ,
751a8d50686STom Rhodes.Xr xargs 1 ,
7529b50d902SRodney W. Grimes.Xr stat 2 ,
7539b50d902SRodney W. Grimes.Xr fts 3 ,
7549b50d902SRodney W. Grimes.Xr getgrent 3 ,
7559b50d902SRodney W. Grimes.Xr getpwent 3 ,
7569b50d902SRodney W. Grimes.Xr strmode 3 ,
75794ad6032SRuslan Ermilov.Xr re_format 7 ,
7589b50d902SRodney W. Grimes.Xr symlink 7
7599b50d902SRodney W. Grimes.Sh STANDARDS
7609b50d902SRodney W. GrimesThe
7618fe908efSRuslan Ermilov.Nm
7629b50d902SRodney W. Grimesutility syntax is a superset of the syntax specified by the
7639b50d902SRodney W. Grimes.St -p1003.2
7649b50d902SRodney W. Grimesstandard.
7659b50d902SRodney W. Grimes.Pp
766f6e4fb22SSteve PriceAll the single character options as well as the
767bfd12208SRuslan Ermilov.Ic -iname , -inum , -iregex , -print0 , -delete , -ls ,
768f6e4fb22SSteve Priceand
7697c1d4b3aSAkinori MUSHA.Ic -regex
770f6e4fb22SSteve Priceprimaries are extensions to
771f6e4fb22SSteve Price.St -p1003.2 .
772f6e4fb22SSteve Price.Pp
7739b50d902SRodney W. GrimesHistorically, the
774bfd12208SRuslan Ermilov.Fl d , h
7759b50d902SRodney W. Grimesand
7769b50d902SRodney W. Grimes.Fl x
777bfd12208SRuslan Ermilovoptions were implemented using the primaries
778bfd12208SRuslan Ermilov.Ic -depth , -follow ,
779bfd12208SRuslan Ermilovand
780bfd12208SRuslan Ermilov.Ic -xdev .
7819b50d902SRodney W. GrimesThese primaries always evaluated to true.
7829b50d902SRodney W. GrimesAs they were really global variables that took effect before the traversal
7839b50d902SRodney W. Grimesbegan, some legal expressions could have unexpected results.
784bfd12208SRuslan ErmilovAn example is the expression
785bfd12208SRuslan Ermilov.Ic -print Cm -o Ic -depth .
786bfd12208SRuslan ErmilovAs
787bfd12208SRuslan Ermilov.Ic -print
788bfd12208SRuslan Ermilovalways evaluates to true, the standard order of evaluation
789bfd12208SRuslan Ermilovimplies that
790bfd12208SRuslan Ermilov.Ic -depth
791bfd12208SRuslan Ermilovwould never be evaluated.
7929b50d902SRodney W. GrimesThis is not the case.
7939b50d902SRodney W. Grimes.Pp
794bfd12208SRuslan ErmilovThe operator
795bfd12208SRuslan Ermilov.Cm -or
796bfd12208SRuslan Ermilovwas implemented as
797bfd12208SRuslan Ermilov.Cm -o ,
798bfd12208SRuslan Ermilovand the operator
799bfd12208SRuslan Ermilov.Cm -and
800bfd12208SRuslan Ermilovwas implemented as
801bfd12208SRuslan Ermilov.Cm -a .
8029b50d902SRodney W. Grimes.Pp
8039b50d902SRodney W. GrimesHistoric implementations of the
804bfd12208SRuslan Ermilov.Ic -exec
8059b50d902SRodney W. Grimesand
806bfd12208SRuslan Ermilov.Ic -ok
807bfd12208SRuslan Ermilovprimaries did not replace the string
808bfd12208SRuslan Ermilov.Dq Li {}
809bfd12208SRuslan Ermilovin the utility name or the
8109b50d902SRodney W. Grimesutility arguments if it had preceding or following non-whitespace characters.
8119b50d902SRodney W. GrimesThis version replaces it no matter where in the utility name or arguments
8129b50d902SRodney W. Grimesit appears.
8137c1d4b3aSAkinori MUSHA.Pp
8147c1d4b3aSAkinori MUSHAThe
8157c1d4b3aSAkinori MUSHA.Fl E
8167c1d4b3aSAkinori MUSHAoption was implemented on the analogy of
8177c1d4b3aSAkinori MUSHA.Xr grep 1
8187c1d4b3aSAkinori MUSHAand
8197c1d4b3aSAkinori MUSHA.Xr sed 1 .
8209b50d902SRodney W. Grimes.Sh BUGS
8219b50d902SRodney W. GrimesThe special characters used by
8228fe908efSRuslan Ermilov.Nm
8239b50d902SRodney W. Grimesare also special characters to many shell programs.
824bfd12208SRuslan ErmilovIn particular, the characters
825bfd12208SRuslan Ermilov.Dq Li * ,
826bfd12208SRuslan Ermilov.Dq Li \&[ ,
827bfd12208SRuslan Ermilov.Dq Li \&] ,
828bfd12208SRuslan Ermilov.Dq Li \&? ,
829bfd12208SRuslan Ermilov.Dq Li \&( ,
830bfd12208SRuslan Ermilov.Dq Li \&) ,
831bfd12208SRuslan Ermilov.Dq Li \&! ,
832bfd12208SRuslan Ermilov.Dq Li \e
833bfd12208SRuslan Ermilovand
834bfd12208SRuslan Ermilov.Dq Li \&;
835bfd12208SRuslan Ermilovmay have to be escaped from the shell.
8369b50d902SRodney W. Grimes.Pp
8379b50d902SRodney W. GrimesAs there is no delimiter separating options and file names or file
8389b50d902SRodney W. Grimesnames and the
8399b50d902SRodney W. Grimes.Ar expression ,
840bfd12208SRuslan Ermilovit is difficult to specify files named
841bfd12208SRuslan Ermilov.Pa -xdev
842bfd12208SRuslan Ermilovor
843bfd12208SRuslan Ermilov.Pa \&! .
8449b50d902SRodney W. GrimesThese problems are handled by the
8459b50d902SRodney W. Grimes.Fl f
8469b50d902SRodney W. Grimesoption and the
8479b50d902SRodney W. Grimes.Xr getopt 3
848bfd12208SRuslan Ermilov.Dq Fl Fl
849bfd12208SRuslan Ermilovconstruct.
850abacbbbfSPeter Wemm.Pp
851abacbbbfSPeter WemmThe
852abacbbbfSPeter Wemm.Ic -delete
85356f7a840SBill Fumerolaprimary does not interact well with other options that cause the filesystem
854abacbbbfSPeter Wemmtree traversal options to be changed.
855b8923d4cSWolfram Schneider.Sh HISTORY
856b8923d4cSWolfram SchneiderA
857b8923d4cSWolfram Schneider.Nm
858b8923d4cSWolfram Schneidercommand appeared in
859b8923d4cSWolfram Schneider.At v1 .
860