xref: /freebsd/usr.bin/find/find.1 (revision a66a6a2a0cc823b0ec4e1b9998bc4e2446264aa0)
158540776STim J. Robbins.\" 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.\"
35841484cdSPeter Wemm.\"	@(#)find.1	8.7 (Berkeley) 5/9/95
36c3aac50fSPeter Wemm.\" $FreeBSD$
379b50d902SRodney W. Grimes.\"
383b0fbd31SRuslan Ermilov.Dd December 13, 2006
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
458fe908efSRuslan Ermilov.Nm
469b50d902SRodney W. Grimes.Op Fl H | Fl L | Fl P
477c1d4b3aSAkinori MUSHA.Op Fl EXdsx
480c101fb2SJoseph Koshy.Op Fl f Ar pathname
49107f86a2SStefan Farfeleder.Ar pathname ...
50107f86a2SStefan Farfeleder.Ar expression
51107f86a2SStefan Farfeleder.Nm
52107f86a2SStefan Farfeleder.Op Fl H | Fl L | Fl P
53107f86a2SStefan Farfeleder.Op Fl EXdsx
54107f86a2SStefan Farfeleder.Fl f Ar pathname
55bfd12208SRuslan Ermilov.Op Ar pathname ...
569b50d902SRodney W. Grimes.Ar expression
579b50d902SRodney W. Grimes.Sh DESCRIPTION
58e8937ba0SPhilippe CharnierThe
59e8937ba0SPhilippe Charnier.Nm
60e8937ba0SPhilippe Charnierutility recursively descends the directory tree for each
610c101fb2SJoseph Koshy.Ar pathname
629b50d902SRodney W. Grimeslisted, evaluating an
639b50d902SRodney W. Grimes.Ar expression
64bfd12208SRuslan Ermilov(composed of the
65bfd12208SRuslan Ermilov.Dq primaries
66bfd12208SRuslan Ermilovand
67bfd12208SRuslan Ermilov.Dq operands
68bfd12208SRuslan Ermilovlisted below) in terms
699b50d902SRodney W. Grimesof each file in the tree.
709b50d902SRodney W. Grimes.Pp
719b50d902SRodney W. GrimesThe options are as follows:
72bfd12208SRuslan Ermilov.Bl -tag -width indent
737c1d4b3aSAkinori MUSHA.It Fl E
747c1d4b3aSAkinori MUSHAInterpret regular expressions followed by
757c1d4b3aSAkinori MUSHA.Ic -regex
767c1d4b3aSAkinori MUSHAand
777c1d4b3aSAkinori MUSHA.Ic -iregex
78fbccd9dbSRuslan Ermilovprimaries as extended (modern) regular expressions rather than basic
79bfd12208SRuslan Ermilovregular expressions (BRE's).
80bfd12208SRuslan ErmilovThe
817c1d4b3aSAkinori MUSHA.Xr re_format 7
827c1d4b3aSAkinori MUSHAmanual page fully describes both formats.
839b50d902SRodney W. Grimes.It Fl H
843c94f41fSPhilippe CharnierCause the file information and file type (see
859b50d902SRodney W. Grimes.Xr stat 2 )
869b50d902SRodney W. Grimesreturned for each symbolic link specified on the command line to be
879b50d902SRodney W. Grimesthose of the file referenced by the link, not the link itself.
889b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will
896df69548SBruce Evansbe for the link itself.
906df69548SBruce EvansFile information of all symbolic links not on
919b50d902SRodney W. Grimesthe command line is that of the link itself.
929b50d902SRodney W. Grimes.It Fl L
933c94f41fSPhilippe CharnierCause the file information and file type (see
949b50d902SRodney W. Grimes.Xr stat 2 )
959b50d902SRodney W. Grimesreturned for each symbolic link to be those of the file referenced by the
969b50d902SRodney W. Grimeslink, not the link itself.
979b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will
989b50d902SRodney W. Grimesbe for the link itself.
9947d91ba3SDag-Erling Smørgrav.Pp
10047d91ba3SDag-Erling SmørgravThis option is equivalent to the deprecated
10147d91ba3SDag-Erling Smørgrav.Ic -follow
10247d91ba3SDag-Erling Smørgravprimary.
1039b50d902SRodney W. Grimes.It Fl P
1043c94f41fSPhilippe CharnierCause the file information and file type (see
1059b50d902SRodney W. Grimes.Xr stat 2 )
1069b50d902SRodney W. Grimesreturned for each symbolic link to be those of the link itself.
1073d9a9402SJohn PolstraThis is the default.
1089b50d902SRodney W. Grimes.It Fl X
1093c94f41fSPhilippe CharnierPermit
1109b50d902SRodney W. Grimes.Nm
1119b50d902SRodney W. Grimesto be safely used in conjunction with
1129b50d902SRodney W. Grimes.Xr xargs 1 .
1139b50d902SRodney W. GrimesIf a file name contains any of the delimiting characters used by
114bfd12208SRuslan Ermilov.Xr xargs 1 ,
1159b50d902SRodney W. Grimesa diagnostic message is displayed on standard error, and the file
1169b50d902SRodney W. Grimesis skipped.
117bfd12208SRuslan ErmilovThe delimiting characters include single
118bfd12208SRuslan Ermilov.Pq Dq Li " ' "
119bfd12208SRuslan Ermilovand double
120bfd12208SRuslan Ermilov.Pq Dq Li " \*q "
121bfd12208SRuslan Ermilovquotes, backslash
122bfd12208SRuslan Ermilov.Pq Dq Li \e ,
123bfd12208SRuslan Ermilovspace, tab and newline characters.
124a8d50686STom Rhodes.Pp
125a8d50686STom RhodesHowever, you may wish to consider the
126a8d50686STom Rhodes.Fl print0
127a8d50686STom Rhodesprimary in conjunction with
128e2f8ed51SRuslan Ermilov.Dq Nm xargs Fl 0
129a8d50686STom Rhodesas an effective alternative.
1309b50d902SRodney W. Grimes.It Fl d
1313c94f41fSPhilippe CharnierCause
1328fe908efSRuslan Ermilov.Nm
13354874bb6SRuslan Ermilovto perform a depth-first traversal, i.e., directories
13454874bb6SRuslan Ermilovare visited in post-order and all entries in a directory will be acted
1359b50d902SRodney W. Grimeson before the directory itself.
1369b50d902SRodney W. GrimesBy default,
1378fe908efSRuslan Ermilov.Nm
13854874bb6SRuslan Ermilovvisits directories in pre-order, i.e., before their contents.
1399b50d902SRodney W. GrimesNote, the default is
140bfd12208SRuslan Ermilov.Em not
14154874bb6SRuslan Ermilova breadth-first traversal.
14247d91ba3SDag-Erling Smørgrav.Pp
1431c832963SOliver EikemeierThis option is equivalent to the
14447d91ba3SDag-Erling Smørgrav.Ic -depth
1451c832963SOliver Eikemeierprimary of
1461c832963SOliver Eikemeier.St -p1003.1-2001 .
147fbccd9dbSRuslan ErmilovThe
1481c832963SOliver Eikemeier.Fl d
149fbccd9dbSRuslan Ermilovoption
1501c832963SOliver Eikemeiercan be useful when
1511c832963SOliver Eikemeier.Nm
1521c832963SOliver Eikemeieris used with
1531c832963SOliver Eikemeier.Xr cpio 1
1541c832963SOliver Eikemeierto process files that are contained in directories with unusual permissions.
1551c832963SOliver EikemeierIt ensures that you have write permission while you are placing files in a
1561c832963SOliver Eikemeierdirectory, then sets the directory's permissions as the last thing.
1579b50d902SRodney W. Grimes.It Fl f
1583c94f41fSPhilippe CharnierSpecify a file hierarchy for
1598fe908efSRuslan Ermilov.Nm
1609b50d902SRodney W. Grimesto traverse.
1619b50d902SRodney W. GrimesFile hierarchies may also be specified as the operands immediately
1629b50d902SRodney W. Grimesfollowing the options.
1636d0c7e13SWolfram Schneider.It Fl s
1643c94f41fSPhilippe CharnierCause
1658fe908efSRuslan Ermilov.Nm
1666df69548SBruce Evansto traverse the file hierarchies in lexicographical order,
1676df69548SBruce Evansi.e., alphabetical order within each directory.
1686df69548SBruce EvansNote:
169bfd12208SRuslan Ermilov.Ql find -s
1706d0c7e13SWolfram Schneiderand
171bfd12208SRuslan Ermilov.Ql "find | sort"
1726d0c7e13SWolfram Schneidermay give different results.
1739b50d902SRodney W. Grimes.It Fl x
1743c94f41fSPhilippe CharnierPrevent
1758fe908efSRuslan Ermilov.Nm
1769b50d902SRodney W. Grimesfrom descending into directories that have a device number different
1779b50d902SRodney W. Grimesthan that of the file from which the descent began.
17847d91ba3SDag-Erling Smørgrav.Pp
17947d91ba3SDag-Erling SmørgravThis option is equivalent to the deprecated
18047d91ba3SDag-Erling Smørgrav.Ic -xdev
18147d91ba3SDag-Erling Smørgravprimary.
1829b50d902SRodney W. Grimes.El
1839b50d902SRodney W. Grimes.Sh PRIMARIES
184bfd12208SRuslan Ermilov.Bl -tag -width indent
18531d53425SCeri Davies.It Ic -Bmin Ar n
18631d53425SCeri DaviesTrue if the difference between the time of a file's inode creation
18731d53425SCeri Daviesand the time
18831d53425SCeri Davies.Nm
18931d53425SCeri Davieswas started, rounded up to the next full minute, is
19031d53425SCeri Davies.Ar n
19131d53425SCeri Daviesminutes.
19231d53425SCeri Davies.It Ic -Bnewer Ar file
19331d53425SCeri DaviesSame as
19431d53425SCeri Davies.Ic -newerBm .
19531d53425SCeri Davies.It Ic -Btime Ar n Ns Op Cm smhdw
19631d53425SCeri DaviesIf no units are specified, this primary evaluates to
19731d53425SCeri Daviestrue if the difference between the time of a file's inode creation
19831d53425SCeri Daviesand the time
19931d53425SCeri Davies.Nm
20031d53425SCeri Davieswas started, rounded up to the next full 24-hour period, is
20131d53425SCeri Davies.Ar n
20231d53425SCeri Davies24-hour periods.
20331d53425SCeri Davies.Pp
20431d53425SCeri DaviesIf units are specified, this primary evaluates to
2053b0fbd31SRuslan Ermilovtrue if the difference between the time of a file's inode creation
2063b0fbd31SRuslan Ermilovand the time
20731d53425SCeri Davies.Nm
20831d53425SCeri Davieswas started is exactly
20931d53425SCeri Davies.Ar n
21031d53425SCeri Daviesunits.
21131d53425SCeri DaviesPlease refer to the
21231d53425SCeri Davies.Ic -atime
21331d53425SCeri Daviesprimary description for information on supported time units.
21453e87059STom Rhodes.It Ic -acl
215fbccd9dbSRuslan ErmilovMay be used in conjunction with other primaries to locate
21653e87059STom Rhodesfiles with extended ACLs.
21753e87059STom RhodesSee
21853e87059STom Rhodes.Xr acl 3
21953e87059STom Rhodesfor more information.
2203f5223f8SWolfram Schneider.It Ic -amin Ar n
2213f5223f8SWolfram SchneiderTrue if the difference between the file last access time and the time
2228fe908efSRuslan Ermilov.Nm
22345fe9882SMatthew Huntwas started, rounded up to the next full minute, is
2243f5223f8SWolfram Schneider.Ar n
22545fe9882SMatthew Huntminutes.
226ea92232aSPoul-Henning Kamp.It Ic -anewer Ar file
227ea92232aSPoul-Henning KampSame as
228ea92232aSPoul-Henning Kamp.Ic -neweram .
229adff4fcaSRuslan Ermilov.It Ic -atime Ar n Ns Op Cm smhdw
230adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to
231adff4fcaSRuslan Ermilovtrue if the difference between the file last access time and the time
2328fe908efSRuslan Ermilov.Nm
23354874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is
2349b50d902SRodney W. Grimes.Ar n
23554874bb6SRuslan Ermilov24-hour periods.
236adff4fcaSRuslan Ermilov.Pp
237adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to
238adff4fcaSRuslan Ermilovtrue if the difference between the file last access time and the time
239adff4fcaSRuslan Ermilov.Nm
240adff4fcaSRuslan Ermilovwas started is exactly
241adff4fcaSRuslan Ermilov.Ar n
242adff4fcaSRuslan Ermilovunits.
243adff4fcaSRuslan ErmilovPossible time units are as follows:
244adff4fcaSRuslan Ermilov.Pp
245adff4fcaSRuslan Ermilov.Bl -tag -width indent -compact
246adff4fcaSRuslan Ermilov.It Cm s
247adff4fcaSRuslan Ermilovsecond
248adff4fcaSRuslan Ermilov.It Cm m
249adff4fcaSRuslan Ermilovminute (60 seconds)
250adff4fcaSRuslan Ermilov.It Cm h
251adff4fcaSRuslan Ermilovhour (60 minutes)
252adff4fcaSRuslan Ermilov.It Cm d
253adff4fcaSRuslan Ermilovday (24 hours)
254adff4fcaSRuslan Ermilov.It Cm w
255adff4fcaSRuslan Ermilovweek (7 days)
256adff4fcaSRuslan Ermilov.El
257adff4fcaSRuslan Ermilov.Pp
258adff4fcaSRuslan ErmilovAny number of units may be combined in one
259adff4fcaSRuslan Ermilov.Ic -atime
260adff4fcaSRuslan Ermilovargument, for example,
261adff4fcaSRuslan Ermilov.Dq Li "-atime -1h30m" .
262adff4fcaSRuslan ErmilovUnits are probably only useful when used in conjunction with the
263adff4fcaSRuslan Ermilov.Cm +
264adff4fcaSRuslan Ermilovor
265adff4fcaSRuslan Ermilov.Cm -
266adff4fcaSRuslan Ermilovmodifier.
2673f5223f8SWolfram Schneider.It Ic -cmin Ar n
2683f5223f8SWolfram SchneiderTrue if the difference between the time of last change of file status
2693f5223f8SWolfram Schneiderinformation and the time
2708fe908efSRuslan Ermilov.Nm
27145fe9882SMatthew Huntwas started, rounded up to the next full minute, is
2723f5223f8SWolfram Schneider.Ar n
27345fe9882SMatthew Huntminutes.
274ea92232aSPoul-Henning Kamp.It Ic -cnewer Ar file
275ea92232aSPoul-Henning KampSame as
276ea92232aSPoul-Henning Kamp.Ic -newercm .
277adff4fcaSRuslan Ermilov.It Ic -ctime Ar n Ns Op Cm smhdw
278adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to
279adff4fcaSRuslan Ermilovtrue if the difference between the time of last change of file status
2809b50d902SRodney W. Grimesinformation and the time
2818fe908efSRuslan Ermilov.Nm
28254874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is
2839b50d902SRodney W. Grimes.Ar n
28454874bb6SRuslan Ermilov24-hour periods.
285adff4fcaSRuslan Ermilov.Pp
286adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to
287adff4fcaSRuslan Ermilovtrue if the difference between the time of last change of file status
288adff4fcaSRuslan Ermilovinformation and the time
289adff4fcaSRuslan Ermilov.Nm
290adff4fcaSRuslan Ermilovwas started is exactly
291adff4fcaSRuslan Ermilov.Ar n
292adff4fcaSRuslan Ermilovunits.
293adff4fcaSRuslan ErmilovPlease refer to the
294adff4fcaSRuslan Ermilov.Ic -atime
295adff4fcaSRuslan Ermilovprimary description for information on supported time units.
29646b993ffSWarner Losh.It Ic -d
29746b993ffSWarner LoshSame as
29846b993ffSWarner Losh.Ic depth .
29946b993ffSWarner LoshGNU find implements this as a primary in mistaken emulation of
30046b993ffSWarner Losh.Fx
30146b993ffSWarner Losh.Xr find 1 .
302abacbbbfSPeter Wemm.It Ic -delete
3036df69548SBruce EvansDelete found files and/or directories.
3046df69548SBruce EvansAlways returns true.
3056df69548SBruce EvansThis executes
306abacbbbfSPeter Wemmfrom the current working directory as
307abacbbbfSPeter Wemm.Nm
3086df69548SBruce Evansrecurses down the tree.
309bfd12208SRuslan ErmilovIt will not attempt to delete a filename with a
310bfd12208SRuslan Ermilov.Dq Pa /
311bfd12208SRuslan Ermilovcharacter in its pathname relative to
312bfd12208SRuslan Ermilov.Dq Pa \&.
313bfd12208SRuslan Ermilovfor security reasons.
31454874bb6SRuslan ErmilovDepth-first traversal processing is implied by this option.
3159b4e871aSDavid E. O'Brien.It Ic -depth
3169b4e871aSDavid E. O'BrienAlways true;
3179b4e871aSDavid E. O'Briensame as the
3189b4e871aSDavid E. O'Brien.Fl d
3199b4e871aSDavid E. O'Brienoption.
3201c832963SOliver Eikemeier.It Ic -depth Ar n
3211c832963SOliver EikemeierTrue if the depth of the file relative to the starting point of the traversal
3221c832963SOliver Eikemeieris
3231c832963SOliver Eikemeier.Ar n .
324ed1a4621SPeter Wemm.It Ic -empty
325ed1a4621SPeter WemmTrue if the current file or directory is empty.
326c93e83feSRuslan Ermilov.It Ic -exec Ar utility Oo Ar argument ... Oc Li \&;
3279b50d902SRodney W. GrimesTrue if the program named
3289b50d902SRodney W. Grimes.Ar utility
3299b50d902SRodney W. Grimesreturns a zero value as its exit status.
330bfd12208SRuslan ErmilovOptional
331bfd12208SRuslan Ermilov.Ar arguments
332bfd12208SRuslan Ermilovmay be passed to the utility.
333bfd12208SRuslan ErmilovThe expression must be terminated by a semicolon
334bfd12208SRuslan Ermilov.Pq Dq Li \&; .
3356a2b59f8SJens SchweikhardtIf you invoke
3366a2b59f8SJens Schweikhardt.Nm
3376a2b59f8SJens Schweikhardtfrom a shell you may need to quote the semicolon if the shell would
3386a2b59f8SJens Schweikhardtotherwise treat it as a control operator.
339bfd12208SRuslan ErmilovIf the string
340bfd12208SRuslan Ermilov.Dq Li {}
341bfd12208SRuslan Ermilovappears anywhere in the utility name or the
3429b50d902SRodney W. Grimesarguments it is replaced by the pathname of the current file.
3439b50d902SRodney W. Grimes.Ar Utility
3449b50d902SRodney W. Grimeswill be executed from the directory from which
3458fe908efSRuslan Ermilov.Nm
3469b50d902SRodney W. Grimeswas executed.
34708274979SYaroslav Tykhiy.Ar Utility
34808274979SYaroslav Tykhiyand
34908274979SYaroslav Tykhiy.Ar arguments
35008274979SYaroslav Tykhiyare not subject to the further expansion of shell patterns
35108274979SYaroslav Tykhiyand constructs.
352c93e83feSRuslan Ermilov.It Ic -exec Ar utility Oo Ar argument ... Oc Li {} +
3535e25d888STim J. RobbinsSame as
3545e25d888STim J. Robbins.Ic -exec ,
3555e25d888STim J. Robbinsexcept that
3565e25d888STim J. Robbins.Dq Li {}
3575e25d888STim J. Robbinsis replaced with as many pathnames as possible for each invocation of
3585e25d888STim J. Robbins.Ar utility .
3595e25d888STim J. RobbinsThis behaviour is similar to that of
3605e25d888STim J. Robbins.Xr xargs 1 .
361c93e83feSRuslan Ermilov.It Ic -execdir Ar utility Oo Ar argument ... Oc Li \&;
362127d7563SWarner LoshThe
363bfd12208SRuslan Ermilov.Ic -execdir
364127d7563SWarner Loshprimary is identical to the
365127d7563SWarner Losh.Ic -exec
366127d7563SWarner Loshprimary with the exception that
367bfd12208SRuslan Ermilov.Ar utility
368127d7563SWarner Loshwill be executed from the directory that holds
3696df69548SBruce Evansthe current file.
3706df69548SBruce EvansThe filename substituted for
371bfd12208SRuslan Ermilovthe string
372bfd12208SRuslan Ermilov.Dq Li {}
373bfd12208SRuslan Ermilovis not qualified.
37446b993ffSWarner Losh.It Ic -execdir Ar utility Oo Ar argument ... Oc Li {} +
37546b993ffSWarner LoshSame as
37646b993ffSWarner Losh.Ic -execdir ,
37746b993ffSWarner Loshexcept that
37846b993ffSWarner Losh.Dq Li {}
37946b993ffSWarner Loshis replaced with as many pathnames as possible for each invocation of
38046b993ffSWarner Losh.Ar utility .
38146b993ffSWarner LoshThis behaviour is similar to that of
38246b993ffSWarner Losh.Xr xargs 1 .
3837fd5ee41SRuslan Ermilov.It Ic -flags Oo Cm - Ns | Ns Cm + Oc Ns Ar flags , Ns Ar notflags
3847fd5ee41SRuslan ErmilovThe flags are specified using symbolic names (see
385208691fcSRuslan Ermilov.Xr chflags 1 ) .
3867fd5ee41SRuslan ErmilovThose with the
3877fd5ee41SRuslan Ermilov.Qq Li no
3887fd5ee41SRuslan Ermilovprefix (except
3897fd5ee41SRuslan Ermilov.Qq Li nodump )
3907fd5ee41SRuslan Ermilovare said to be
3917fd5ee41SRuslan Ermilov.Ar notflags .
3927fd5ee41SRuslan ErmilovFlags in
3937fd5ee41SRuslan Ermilov.Ar flags
3947fd5ee41SRuslan Ermilovare checked to be set, and flags in
3957fd5ee41SRuslan Ermilov.Ar notflags
3967fd5ee41SRuslan Ermilovare checked to be not set.
397208691fcSRuslan ErmilovNote that this is different from
398208691fcSRuslan Ermilov.Ic -perm ,
3997fd5ee41SRuslan Ermilovwhich only allows the user to specify mode bits that are set.
4007fd5ee41SRuslan Ermilov.Pp
4017fd5ee41SRuslan ErmilovIf flags are preceded by a dash
4027fd5ee41SRuslan Ermilov.Pq Dq Li - ,
4037fd5ee41SRuslan Ermilovthis primary evaluates to true
4047fd5ee41SRuslan Ermilovif at least all of the bits in
4057fd5ee41SRuslan Ermilov.Ar flags
4067fd5ee41SRuslan Ermilovand none of the bits in
4077fd5ee41SRuslan Ermilov.Ar notflags
4087fd5ee41SRuslan Ermilovare set in the file's flags bits.
4097fd5ee41SRuslan ErmilovIf flags are preceded by a plus
4107fd5ee41SRuslan Ermilov.Pq Dq Li + ,
4117fd5ee41SRuslan Ermilovthis primary evaluates to true
4127fd5ee41SRuslan Ermilovif any of the bits in
4137fd5ee41SRuslan Ermilov.Ar flags
4147fd5ee41SRuslan Ermilovis set in the file's flags bits,
4157fd5ee41SRuslan Ermilovor any of the bits in
4167fd5ee41SRuslan Ermilov.Ar notflags
4177fd5ee41SRuslan Ermilovis not set in the file's flags bits.
4187fd5ee41SRuslan ErmilovOtherwise,
4197fd5ee41SRuslan Ermilovthis primary evaluates to true
4207fd5ee41SRuslan Ermilovif the bits in
4217fd5ee41SRuslan Ermilov.Ar flags
4227fd5ee41SRuslan Ermilovexactly match the file's flags bits,
4237fd5ee41SRuslan Ermilovand none of the
4247fd5ee41SRuslan Ermilov.Ar flags
4257fd5ee41SRuslan Ermilovbits match those of
4267fd5ee41SRuslan Ermilov.Ar notflags .
4279b50d902SRodney W. Grimes.It Ic -fstype Ar type
4289b50d902SRodney W. GrimesTrue if the file is contained in a file system of type
4299b50d902SRodney W. Grimes.Ar type .
430841484cdSPeter WemmThe
431841484cdSPeter Wemm.Xr sysctl 8
432841484cdSPeter Wemmcommand can be used to find out the types of file systems
433841484cdSPeter Wemmthat are available on the system:
434bfd12208SRuslan Ermilov.Pp
435bfd12208SRuslan Ermilov.Dl "sysctl vfs"
436bfd12208SRuslan Ermilov.Pp
437bfd12208SRuslan ErmilovIn addition, there are two pseudo-types,
438bfd12208SRuslan Ermilov.Dq Li local
439bfd12208SRuslan Ermilovand
440bfd12208SRuslan Ermilov.Dq Li rdonly .
4419b50d902SRodney W. GrimesThe former matches any file system physically mounted on the system where
4429b50d902SRodney W. Grimesthe
4438fe908efSRuslan Ermilov.Nm
4449b50d902SRodney W. Grimesis being executed and the latter matches any file system which is
4459b50d902SRodney W. Grimesmounted read-only.
44646b993ffSWarner Losh.It Ic -gid Ar gname
44746b993ffSWarner LoshThe same thing as
44846b993ffSWarner Losh.Ar -group Ar gname
44946b993ffSWarner Loshfor compatibility with GNU find.
45046b993ffSWarner LoshGNU find imposes a restriction that
45146b993ffSWarner Losh.Ar gname
45246b993ffSWarner Loshis numeric, while
45346b993ffSWarner Losh.Xr find 1
45446b993ffSWarner Loshdoes not.
4559b50d902SRodney W. Grimes.It Ic -group Ar gname
4569b50d902SRodney W. GrimesTrue if the file belongs to the group
4579b50d902SRodney W. Grimes.Ar gname .
4589b50d902SRodney W. GrimesIf
4599b50d902SRodney W. Grimes.Ar gname
4609b50d902SRodney W. Grimesis numeric and there is no such group name, then
4619b50d902SRodney W. Grimes.Ar gname
462bfd12208SRuslan Ermilovis treated as a group ID.
46346b993ffSWarner Losh.It Ic -ignore_readdir_race
46446b993ffSWarner LoshThis option is for GNU find compatibility and is ignored.
46546b993ffSWarner Losh.It Ic -ilname Ar pattern
46646b993ffSWarner LoshLike
46746b993ffSWarner Losh.Ic -lname ,
46846b993ffSWarner Loshbut the match is case insensitive.
469a66a6a2aSWarner LoshThis is a GNU find extension.
470208691fcSRuslan Ermilov.It Ic -iname Ar pattern
471208691fcSRuslan ErmilovLike
472208691fcSRuslan Ermilov.Ic -name ,
473208691fcSRuslan Ermilovbut the match is case insensitive.
4749b50d902SRodney W. Grimes.It Ic -inum Ar n
4759b50d902SRodney W. GrimesTrue if the file has inode number
4769b50d902SRodney W. Grimes.Ar n .
477208691fcSRuslan Ermilov.It Ic -ipath Ar pattern
478208691fcSRuslan ErmilovLike
479208691fcSRuslan Ermilov.Ic -path ,
480208691fcSRuslan Ermilovbut the match is case insensitive.
481208691fcSRuslan Ermilov.It Ic -iregex Ar pattern
482208691fcSRuslan ErmilovLike
483208691fcSRuslan Ermilov.Ic -regex ,
484208691fcSRuslan Ermilovbut the match is case insensitive.
48546b993ffSWarner Losh.It Ic -iwholename Ar pattern
48646b993ffSWarner LoshThe same thing as
48746b993ffSWarner Losh.Ic -ipath ,
48846b993ffSWarner Loshfor GNU find compatibility.
4899b50d902SRodney W. Grimes.It Ic -links Ar n
4909b50d902SRodney W. GrimesTrue if the file has
4919b50d902SRodney W. Grimes.Ar n
4929b50d902SRodney W. Grimeslinks.
49346b993ffSWarner Losh.It Ic -lname Ar pattern
49446b993ffSWarner LoshLike
49546b993ffSWarner Losh.Ic -name ,
496a66a6a2aSWarner Loshbut the contents of the symbolic link are matched instead of the file
497a66a6a2aSWarner Loshname.
498a66a6a2aSWarner LoshThis is a GNU find extension.
4999b50d902SRodney W. Grimes.It Ic -ls
5009b50d902SRodney W. GrimesThis primary always evaluates to true.
5019b50d902SRodney W. GrimesThe following information for the current file is written to standard output:
50254874bb6SRuslan Ermilovits inode number, size in 512-byte blocks, file permissions, number of hard
5039b50d902SRodney W. Grimeslinks, owner, group, size in bytes, last modification time, and pathname.
5049b50d902SRodney W. GrimesIf the file is a block or character special file, the major and minor numbers
5059b50d902SRodney W. Grimeswill be displayed instead of the size in bytes.
50654874bb6SRuslan ErmilovIf the file is a symbolic link, the pathname of the linked-to file will be
507bfd12208SRuslan Ermilovdisplayed preceded by
508bfd12208SRuslan Ermilov.Dq Li -> .
509bfd12208SRuslan ErmilovThe format is identical to that produced by
510bfd12208SRuslan Ermilov.Bk -words
511fbccd9dbSRuslan Ermilov.Dq Nm ls Fl dgils .
512bfd12208SRuslan Ermilov.Ek
513c76bc8f3SOllivier Robert.It Ic -maxdepth Ar n
5149c61111dSOliver EikemeierAlways true; descend at most
5159c61111dSOliver Eikemeier.Ar n
5169c61111dSOliver Eikemeierdirectory levels below the command line arguments.
517d79829afSOliver EikemeierIf any
518d79829afSOliver Eikemeier.Ic -maxdepth
519d79829afSOliver Eikemeierprimary is specified, it applies to the entire expression even if it would
520d79829afSOliver Eikemeiernot normally be evaluated.
521fbccd9dbSRuslan Ermilov.Dq Ic -maxdepth Li 0
522d79829afSOliver Eikemeierlimits the whole search to the command line arguments.
523c76bc8f3SOllivier Robert.It Ic -mindepth Ar n
5249c61111dSOliver EikemeierAlways true; do not apply any tests or actions at levels less than
5259c61111dSOliver Eikemeier.Ar n .
526d79829afSOliver EikemeierIf any
527d79829afSOliver Eikemeier.Ic -mindepth
528d79829afSOliver Eikemeierprimary is specified, it applies to the entire expression even if it would
529d79829afSOliver Eikemeiernot normally be evaluated.
530fbccd9dbSRuslan Ermilov.Dq Ic -mindepth Li 1
531d79829afSOliver Eikemeierprocesses all but the command line arguments.
5323f5223f8SWolfram Schneider.It Ic -mmin Ar n
5333f5223f8SWolfram SchneiderTrue if the difference between the file last modification time and the time
5348fe908efSRuslan Ermilov.Nm
53545fe9882SMatthew Huntwas started, rounded up to the next full minute, is
5363f5223f8SWolfram Schneider.Ar n
53745fe9882SMatthew Huntminutes.
538208691fcSRuslan Ermilov.It Ic -mnewer Ar file
539208691fcSRuslan ErmilovSame as
540208691fcSRuslan Ermilov.Ic -newer .
54146b993ffSWarner Losh.It Ic -mount
54246b993ffSWarner LoshThe same thing as
54346b993ffSWarner Losh.Ic -xdev ,
54446b993ffSWarner Loshfor GNU find compatibility.
545adff4fcaSRuslan Ermilov.It Ic -mtime Ar n Ns Op Cm smhdw
546adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to
547adff4fcaSRuslan Ermilovtrue if the difference between the file last modification time and the time
5488fe908efSRuslan Ermilov.Nm
54954874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is
5509b50d902SRodney W. Grimes.Ar n
55154874bb6SRuslan Ermilov24-hour periods.
552adff4fcaSRuslan Ermilov.Pp
553adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to
554adff4fcaSRuslan Ermilovtrue if the difference between the file last modification time and the time
555adff4fcaSRuslan Ermilov.Nm
556adff4fcaSRuslan Ermilovwas started is exactly
557adff4fcaSRuslan Ermilov.Ar n
558adff4fcaSRuslan Ermilovunits.
559adff4fcaSRuslan ErmilovPlease refer to the
560adff4fcaSRuslan Ermilov.Ic -atime
561adff4fcaSRuslan Ermilovprimary description for information on supported time units.
5629b50d902SRodney W. Grimes.It Ic -name Ar pattern
5639b50d902SRodney W. GrimesTrue if the last component of the pathname being examined matches
5649b50d902SRodney W. Grimes.Ar pattern .
565bfd12208SRuslan ErmilovSpecial shell pattern matching characters
566bfd12208SRuslan Ermilov.Dq ( Li \&[ ,
567bfd12208SRuslan Ermilov.Dq Li \&] ,
568bfd12208SRuslan Ermilov.Dq Li * ,
569bfd12208SRuslan Ermilovand
570bfd12208SRuslan Ermilov.Dq Li \&? )
5719b50d902SRodney W. Grimesmay be used as part of
5729b50d902SRodney W. Grimes.Ar pattern .
5739b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a
574bfd12208SRuslan Ermilovbackslash
575bfd12208SRuslan Ermilov.Pq Dq Li \e .
5769b50d902SRodney W. Grimes.It Ic -newer Ar file
5779b50d902SRodney W. GrimesTrue if the current file has a more recent last modification time than
5789b50d902SRodney W. Grimes.Ar file .
579bfd12208SRuslan Ermilov.It Ic -newer Ns Ar X Ns Ar Y Ar file
580bfd12208SRuslan ErmilovTrue if the current file has a more recent last access time
581fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm a ,
58231d53425SCeri Daviesinode creation time
583fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm B ,
584bfd12208SRuslan Ermilovchange time
585fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm c ,
586bfd12208SRuslan Ermilovor modification time
587fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm m
588bfd12208SRuslan Ermilovthan the last access time
589fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm a ,
59031d53425SCeri Daviesinode creation time
591fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm B ,
592bfd12208SRuslan Ermilovchange time
593fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm c ,
594bfd12208SRuslan Ermilovor modification time
595fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm m
596bfd12208SRuslan Ermilovof
597ea92232aSPoul-Henning Kamp.Ar file .
598ea92232aSPoul-Henning KampIn addition, if
599bfd12208SRuslan Ermilov.Ar Y Ns = Ns Cm t ,
600ea92232aSPoul-Henning Kampthen
601ea92232aSPoul-Henning Kamp.Ar file
602ea92232aSPoul-Henning Kampis instead interpreted as a direct date specification of the form
603ea92232aSPoul-Henning Kampunderstood by
604ea92232aSPoul-Henning Kamp.Xr cvs 1 .
605ea92232aSPoul-Henning KampNote that
606ea92232aSPoul-Henning Kamp.Ic -newermm
607ea92232aSPoul-Henning Kampis equivalent to
608ea92232aSPoul-Henning Kamp.Ic -newer .
6099b50d902SRodney W. Grimes.It Ic -nogroup
6109b50d902SRodney W. GrimesTrue if the file belongs to an unknown group.
61146b993ffSWarner Losh.It Ic -noignore_readdir_race
61246b993ffSWarner LoshThis option is for GNU find compatibility and is ignored.
61346b993ffSWarner Losh.It Ic -noleaf
61446b993ffSWarner LoshThis option is for GNU find compatibility.
61546b993ffSWarner LoshIn GNU find it disables an optimization not relevant to
61646b993ffSWarner Losh.Xr find 1 ,
61746b993ffSWarner Loshso it is ignored.
618208691fcSRuslan Ermilov.It Ic -nouser
619208691fcSRuslan ErmilovTrue if the file belongs to an unknown user.
620c93e83feSRuslan Ermilov.It Ic -ok Ar utility Oo Ar argument ... Oc Li \&;
621208691fcSRuslan ErmilovThe
622208691fcSRuslan Ermilov.Ic -ok
623208691fcSRuslan Ermilovprimary is identical to the
624208691fcSRuslan Ermilov.Ic -exec
625208691fcSRuslan Ermilovprimary with the exception that
626208691fcSRuslan Ermilov.Nm
627208691fcSRuslan Ermilovrequests user affirmation for the execution of the
628208691fcSRuslan Ermilov.Ar utility
629208691fcSRuslan Ermilovby printing
630208691fcSRuslan Ermilova message to the terminal and reading a response.
63139c59153SRuslan ErmilovIf the response is not affirmative
63239c59153SRuslan Ermilov.Ql ( y
633ef6c7764STim J. Robbinsin the
634ef6c7764STim J. Robbins.Dq Li POSIX
635ef6c7764STim J. Robbinslocale),
636208691fcSRuslan Ermilovthe command is not executed and the
637208691fcSRuslan Ermilovvalue of the
638208691fcSRuslan Ermilov.Ic -ok
639208691fcSRuslan Ermilovexpression is false.
640c93e83feSRuslan Ermilov.It Ic -okdir Ar utility Oo Ar argument ... Oc Li \&;
641208691fcSRuslan ErmilovThe
642208691fcSRuslan Ermilov.Ic -okdir
643208691fcSRuslan Ermilovprimary is identical to the
644208691fcSRuslan Ermilov.Ic -execdir
645208691fcSRuslan Ermilovprimary with the same exception as described for the
646208691fcSRuslan Ermilov.Ic -ok
647208691fcSRuslan Ermilovprimary.
6489b50d902SRodney W. Grimes.It Ic -path Ar pattern
6499b50d902SRodney W. GrimesTrue if the pathname being examined matches
6509b50d902SRodney W. Grimes.Ar pattern .
651bfd12208SRuslan ErmilovSpecial shell pattern matching characters
652bfd12208SRuslan Ermilov.Dq ( Li \&[ ,
653bfd12208SRuslan Ermilov.Dq Li \&] ,
654bfd12208SRuslan Ermilov.Dq Li * ,
655bfd12208SRuslan Ermilovand
656bfd12208SRuslan Ermilov.Dq Li \&? )
6579b50d902SRodney W. Grimesmay be used as part of
6589b50d902SRodney W. Grimes.Ar pattern .
6599b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a
660bfd12208SRuslan Ermilovbackslash
661bfd12208SRuslan Ermilov.Pq Dq Li \e .
662bfd12208SRuslan ErmilovSlashes
663bfd12208SRuslan Ermilov.Pq Dq Li /
664bfd12208SRuslan Ermilovare treated as normal characters and do not have to be
6659b50d902SRodney W. Grimesmatched explicitly.
6667fd5ee41SRuslan Ermilov.It Ic -perm Oo Cm - Ns | Ns Cm + Oc Ns Ar mode
6679b50d902SRodney W. GrimesThe
6689b50d902SRodney W. Grimes.Ar mode
6699b50d902SRodney W. Grimesmay be either symbolic (see
6709b50d902SRodney W. Grimes.Xr chmod 1 )
6719b50d902SRodney W. Grimesor an octal number.
6727fd5ee41SRuslan ErmilovIf the
6737fd5ee41SRuslan Ermilov.Ar mode
6747fd5ee41SRuslan Ermilovis symbolic, a starting value of zero is assumed and the
6757fd5ee41SRuslan Ermilov.Ar mode
6767fd5ee41SRuslan Ermilovsets or clears permissions without regard to the process' file mode
6779b50d902SRodney W. Grimescreation mask.
6787fd5ee41SRuslan ErmilovIf the
6797fd5ee41SRuslan Ermilov.Ar mode
6807fd5ee41SRuslan Ermilovis octal, only bits 07777
681bfd12208SRuslan Ermilov.Pq Dv S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO
6829b50d902SRodney W. Grimesof the file's mode bits participate
6839b50d902SRodney W. Grimesin the comparison.
6847fd5ee41SRuslan ErmilovIf the
6857fd5ee41SRuslan Ermilov.Ar mode
6867fd5ee41SRuslan Ermilovis preceded by a dash
687bfd12208SRuslan Ermilov.Pq Dq Li - ,
6889b88faecSRuslan Ermilovthis primary evaluates to true
6897fd5ee41SRuslan Ermilovif at least all of the bits in the
6907fd5ee41SRuslan Ermilov.Ar mode
6917fd5ee41SRuslan Ermilovare set in the file's mode bits.
6927fd5ee41SRuslan ErmilovIf the
6937fd5ee41SRuslan Ermilov.Ar mode
6947fd5ee41SRuslan Ermilovis preceded by a plus
695bfd12208SRuslan Ermilov.Pq Dq Li + ,
6969b88faecSRuslan Ermilovthis primary evaluates to true
6977fd5ee41SRuslan Ermilovif any of the bits in the
6987fd5ee41SRuslan Ermilov.Ar mode
6997fd5ee41SRuslan Ermilovare set in the file's mode bits.
7009d2796c3SOllivier RobertOtherwise, this primary evaluates to true if
7017fd5ee41SRuslan Ermilovthe bits in the
7027fd5ee41SRuslan Ermilov.Ar mode
7037fd5ee41SRuslan Ermilovexactly match the file's mode bits.
704bfd12208SRuslan ErmilovNote, the first character of a symbolic mode may not be a dash
705bfd12208SRuslan Ermilov.Pq Dq Li - .
7069b50d902SRodney W. Grimes.It Ic -print
7079b50d902SRodney W. GrimesThis primary always evaluates to true.
7089b50d902SRodney W. GrimesIt prints the pathname of the current file to standard output.
709841484cdSPeter WemmIf none of
710bfd12208SRuslan Ermilov.Ic -exec , -ls , -print0 ,
7119b50d902SRodney W. Grimesor
712bfd12208SRuslan Ermilov.Ic -ok
713841484cdSPeter Wemmis specified, the given expression shall be effectively replaced by
714bfd12208SRuslan Ermilov.Cm \&( Ar "given expression" Cm \&) Ic -print .
7157cd23434SGarrett Wollman.It Ic -print0
7167cd23434SGarrett WollmanThis primary always evaluates to true.
717fbe0d04aSMasafumi Max NAKANEIt prints the pathname of the current file to standard output, followed by an
718cb29445aSRuslan Ermilov.Tn ASCII
719cb29445aSRuslan Ermilov.Dv NUL
7207cd23434SGarrett Wollmancharacter (character code 0).
7219b50d902SRodney W. Grimes.It Ic -prune
7229b50d902SRodney W. GrimesThis primary always evaluates to true.
7239b50d902SRodney W. GrimesIt causes
7248fe908efSRuslan Ermilov.Nm
7259b50d902SRodney W. Grimesto not descend into the current file.
7269b50d902SRodney W. GrimesNote, the
7279b50d902SRodney W. Grimes.Ic -prune
7289b50d902SRodney W. Grimesprimary has no effect if the
7299b50d902SRodney W. Grimes.Fl d
7309b50d902SRodney W. Grimesoption was specified.
731208691fcSRuslan Ermilov.It Ic -regex Ar pattern
732208691fcSRuslan ErmilovTrue if the whole path of the file matches
733208691fcSRuslan Ermilov.Ar pattern
734208691fcSRuslan Ermilovusing regular expression.
735208691fcSRuslan ErmilovTo match a file named
736208691fcSRuslan Ermilov.Dq Pa ./foo/xyzzy ,
737208691fcSRuslan Ermilovyou can use the regular expression
738208691fcSRuslan Ermilov.Dq Li ".*/[xyz]*"
739208691fcSRuslan Ermilovor
740208691fcSRuslan Ermilov.Dq Li ".*/foo/.*" ,
741208691fcSRuslan Ermilovbut not
742208691fcSRuslan Ermilov.Dq Li xyzzy
743208691fcSRuslan Ermilovor
744208691fcSRuslan Ermilov.Dq Li /foo/ .
74546b993ffSWarner Losh.It Ic -samefile Ar name
74646b993ffSWarner LoshTrue if the file is a hard link to
74746b993ffSWarner Losh.Ar name .
74846b993ffSWarner LoshIf the command option
74946b993ffSWarner Losh.Ic -L
75046b993ffSWarner Loshis specified, it is also true if the file is a symbolic link and
75146b993ffSWarner Loshpoints to
75246b993ffSWarner Losh.Ar name .
7535a890aacSKirill Ponomarev.It Ic -size Ar n Ns Op Cm ckMGTP
75454874bb6SRuslan ErmilovTrue if the file's size, rounded up, in 512-byte blocks is
7559b50d902SRodney W. Grimes.Ar n .
7569b50d902SRodney W. GrimesIf
7579b50d902SRodney W. Grimes.Ar n
758bfd12208SRuslan Ermilovis followed by a
759bfd12208SRuslan Ermilov.Cm c ,
760bfd12208SRuslan Ermilovthen the primary is true if the
7619b50d902SRodney W. Grimesfile's size is
7629b50d902SRodney W. Grimes.Ar n
763bfd12208SRuslan Ermilovbytes (characters).
7645a890aacSKirill PonomarevSimilarly if
7655a890aacSKirill Ponomarev.Ar n
7665a890aacSKirill Ponomarevis followed by a scale indicator then the file's size is compared to
7675a890aacSKirill Ponomarev.Ar n
7685a890aacSKirill Ponomarevscaled as:
7695a890aacSKirill Ponomarev.Pp
7705a890aacSKirill Ponomarev.Bl -tag -width indent -compact
7715a890aacSKirill Ponomarev.It Cm k
7725a890aacSKirill Ponomarevkilobytes (1024 bytes)
7735a890aacSKirill Ponomarev.It Cm M
7745a890aacSKirill Ponomarevmegabytes (1024 kilobytes)
7755a890aacSKirill Ponomarev.It Cm G
7765a890aacSKirill Ponomarevgigabytes (1024 megabytes)
7775a890aacSKirill Ponomarev.It Cm T
7785a890aacSKirill Ponomarevterabytes (1024 gigabytes)
7795a890aacSKirill Ponomarev.It Cm P
7805a890aacSKirill Ponomarevpetabytes (1024 terabytes)
7815a890aacSKirill Ponomarev.El
7829b50d902SRodney W. Grimes.It Ic -type Ar t
7839b50d902SRodney W. GrimesTrue if the file is of the specified type.
7849b50d902SRodney W. GrimesPossible file types are as follows:
7859b50d902SRodney W. Grimes.Pp
786bfd12208SRuslan Ermilov.Bl -tag -width indent -compact
7879b50d902SRodney W. Grimes.It Cm b
7889b50d902SRodney W. Grimesblock special
7899b50d902SRodney W. Grimes.It Cm c
7909b50d902SRodney W. Grimescharacter special
7919b50d902SRodney W. Grimes.It Cm d
7929b50d902SRodney W. Grimesdirectory
7939b50d902SRodney W. Grimes.It Cm f
7949b50d902SRodney W. Grimesregular file
7959b50d902SRodney W. Grimes.It Cm l
7969b50d902SRodney W. Grimessymbolic link
7979b50d902SRodney W. Grimes.It Cm p
7989b50d902SRodney W. GrimesFIFO
7999b50d902SRodney W. Grimes.It Cm s
8009b50d902SRodney W. Grimessocket
8019b50d902SRodney W. Grimes.El
80246b993ffSWarner Losh.It Ic -uid Ar uname
80346b993ffSWarner LoshThe same thing as
80446b993ffSWarner Losh.Ar -user Ar uname
80546b993ffSWarner Loshfor compatibility with GNU find.
80646b993ffSWarner LoshGNU find imposes a restriction that
80746b993ffSWarner Losh.Ar uname
80846b993ffSWarner Loshis numeric, while
80946b993ffSWarner Losh.Xr find 1
81046b993ffSWarner Loshdoes not.
8119b50d902SRodney W. Grimes.It Ic -user Ar uname
8129b50d902SRodney W. GrimesTrue if the file belongs to the user
8139b50d902SRodney W. Grimes.Ar uname .
8149b50d902SRodney W. GrimesIf
8159b50d902SRodney W. Grimes.Ar uname
8169b50d902SRodney W. Grimesis numeric and there is no such user name, then
8179b50d902SRodney W. Grimes.Ar uname
818bfd12208SRuslan Ermilovis treated as a user ID.
81946b993ffSWarner Losh.It Ic -wholename Ar pattern
82046b993ffSWarner LoshThe same thing as
82146b993ffSWarner Losh.Ic -path ,
82246b993ffSWarner Loshfor GNU find compatibility.
8239b50d902SRodney W. Grimes.El
8249b50d902SRodney W. Grimes.Pp
8259b50d902SRodney W. GrimesAll primaries which take a numeric argument allow the number to be
8269b88faecSRuslan Ermilovpreceded by a plus sign
827bfd12208SRuslan Ermilov.Pq Dq Li +
8289b88faecSRuslan Ermilovor a minus sign
829bfd12208SRuslan Ermilov.Pq Dq Li - .
830bfd12208SRuslan ErmilovA preceding plus sign means
831bfd12208SRuslan Ermilov.Dq more than n ,
832bfd12208SRuslan Ermilova preceding minus sign means
833bfd12208SRuslan Ermilov.Dq less than n
834bfd12208SRuslan Ermilovand neither means
835bfd12208SRuslan Ermilov.Dq exactly n .
8369b50d902SRodney W. Grimes.Sh OPERATORS
8379b50d902SRodney W. GrimesThe primaries may be combined using the following operators.
8389b50d902SRodney W. GrimesThe operators are listed in order of decreasing precedence.
839bfd12208SRuslan Ermilov.Pp
840fbccd9dbSRuslan Ermilov.Bl -tag -width indent -compact
8410c101fb2SJoseph Koshy.It Cm \&( Ar expression Cm \&)
8429b50d902SRodney W. GrimesThis evaluates to true if the parenthesized expression evaluates to
8439b50d902SRodney W. Grimestrue.
8449b50d902SRodney W. Grimes.Pp
8450c101fb2SJoseph Koshy.It Cm \&! Ar expression
8464a0193d3SJuli Mallett.It Cm -not Ar expression
8479b50d902SRodney W. GrimesThis is the unary
8489b50d902SRodney W. Grimes.Tn NOT
8499b50d902SRodney W. Grimesoperator.
8509b50d902SRodney W. GrimesIt evaluates to true if the expression is false.
8519b50d902SRodney W. Grimes.Pp
85246b993ffSWarner Losh.It Cm -false
85346b993ffSWarner LoshAlways false.
85446b993ffSWarner Losh.It Cm -true
85546b993ffSWarner LoshAlways true.
85646b993ffSWarner Losh.Pp
8579b50d902SRodney W. Grimes.It Ar expression Cm -and Ar expression
8589b50d902SRodney W. Grimes.It Ar expression expression
8599b50d902SRodney W. GrimesThe
8609b50d902SRodney W. Grimes.Cm -and
8619b50d902SRodney W. Grimesoperator is the logical
8629b50d902SRodney W. Grimes.Tn AND
8639b50d902SRodney W. Grimesoperator.
8649b50d902SRodney W. GrimesAs it is implied by the juxtaposition of two expressions it does not
8659b50d902SRodney W. Grimeshave to be specified.
8669b50d902SRodney W. GrimesThe expression evaluates to true if both expressions are true.
8679b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is false.
8689b50d902SRodney W. Grimes.Pp
8699b50d902SRodney W. Grimes.It Ar expression Cm -or Ar expression
8709b50d902SRodney W. GrimesThe
8719b50d902SRodney W. Grimes.Cm -or
8729b50d902SRodney W. Grimesoperator is the logical
8739b50d902SRodney W. Grimes.Tn OR
8749b50d902SRodney W. Grimesoperator.
8759b50d902SRodney W. GrimesThe expression evaluates to true if either the first or the second expression
8769b50d902SRodney W. Grimesis true.
8779b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is true.
8789b50d902SRodney W. Grimes.El
8799b50d902SRodney W. Grimes.Pp
8809b50d902SRodney W. GrimesAll operands and primaries must be separate arguments to
8818fe908efSRuslan Ermilov.Nm .
8829b50d902SRodney W. GrimesPrimaries which themselves take arguments expect each argument
8839b50d902SRodney W. Grimesto be a separate argument to
8848fe908efSRuslan Ermilov.Nm .
885ef6c7764STim J. Robbins.Sh ENVIRONMENT
886ef6c7764STim J. RobbinsThe
887ef6c7764STim J. Robbins.Ev LANG , LC_ALL , LC_COLLATE , LC_CTYPE , LC_MESSAGES
888ef6c7764STim J. Robbinsand
889ef6c7764STim J. Robbins.Ev LC_TIME
890ef6c7764STim J. Robbinsenvironment variables affect the execution of the
891ef6c7764STim J. Robbins.Nm
892ef6c7764STim J. Robbinsutility as described in
893ef6c7764STim J. Robbins.Xr environ 7 .
8949b50d902SRodney W. Grimes.Sh EXAMPLES
8959b50d902SRodney W. GrimesThe following examples are shown as given to the shell:
896bfd12208SRuslan Ermilov.Bl -tag -width indent
8979b50d902SRodney W. Grimes.It Li "find / \e! -name \*q*.c\*q -print"
898bfd12208SRuslan ErmilovPrint out a list of all the files whose names do not end in
899bfd12208SRuslan Ermilov.Pa .c .
9009b50d902SRodney W. Grimes.It Li "find / -newer ttt -user wnj -print"
901bfd12208SRuslan ErmilovPrint out a list of all the files owned by user
902bfd12208SRuslan Ermilov.Dq wnj
903bfd12208SRuslan Ermilovthat are newer
904bfd12208SRuslan Ermilovthan the file
905bfd12208SRuslan Ermilov.Pa ttt .
9069b50d902SRodney W. Grimes.It Li "find / \e! \e( -newer ttt -user wnj \e) -print"
907bfd12208SRuslan ErmilovPrint out a list of all the files which are not both newer than
908bfd12208SRuslan Ermilov.Pa ttt
909bfd12208SRuslan Ermilovand owned by
910bfd12208SRuslan Ermilov.Dq wnj .
9119b50d902SRodney W. Grimes.It Li "find / \e( -newer ttt -or -user wnj \e) -print"
912bfd12208SRuslan ErmilovPrint out a list of all the files that are either owned by
913bfd12208SRuslan Ermilov.Dq wnj
914bfd12208SRuslan Ermilovor that are newer than
915bfd12208SRuslan Ermilov.Pa ttt .
916e578c242STom Rhodes.It Li "find / -newerct '1 minute ago' -print"
917ea92232aSPoul-Henning KampPrint out a list of all the files whose inode change time is more
918ea92232aSPoul-Henning Kamprecent than the current time minus one minute.
91954874bb6SRuslan Ermilov.It Li "find / -type f -exec echo {} \e;"
920e578c242STom RhodesUse the
921e578c242STom Rhodes.Xr echo 1
922e578c242STom Rhodescommand to print out a list of all the files.
9231c832963SOliver Eikemeier.It Li "find -L /usr/ports/packages -type l -delete"
9241c832963SOliver EikemeierDelete all broken symbolic links in
9251c832963SOliver Eikemeier.Pa /usr/ports/packages .
9261c832963SOliver Eikemeier.It Li "find /usr/src -name CVS -prune -o -depth +6 -print"
9271c832963SOliver EikemeierFind files and directories that are at least seven levels deep
9281c832963SOliver Eikemeierin the working directory
9291c832963SOliver Eikemeier.Pa /usr/src .
9301c832963SOliver Eikemeier.It Li "find /usr/src -name CVS -prune -o -mindepth 7 -print"
9311c832963SOliver EikemeierIs not equivalent to the previous example, since
9321c832963SOliver Eikemeier.Ic -prune
9331c832963SOliver Eikemeieris not evaluated below level seven.
9349b50d902SRodney W. Grimes.El
935e578c242STom Rhodes.Sh COMPATIBILITY
936e578c242STom RhodesThe
937e578c242STom Rhodes.Ic -follow
93847d91ba3SDag-Erling Smørgravprimary is deprecated; the
93947d91ba3SDag-Erling Smørgrav.Fl L
94047d91ba3SDag-Erling Smørgravoption should be used instead.
94147d91ba3SDag-Erling SmørgravSee the
94247d91ba3SDag-Erling Smørgrav.Sx STANDARDS
94347d91ba3SDag-Erling Smørgravsection below for details.
9449b50d902SRodney W. Grimes.Sh SEE ALSO
945567664c4SOllivier Robert.Xr chflags 1 ,
9469b50d902SRodney W. Grimes.Xr chmod 1 ,
947ea92232aSPoul-Henning Kamp.Xr cvs 1 ,
9489b50d902SRodney W. Grimes.Xr locate 1 ,
94941cbb624SJoseph Koshy.Xr whereis 1 ,
95041cbb624SJoseph Koshy.Xr which 1 ,
951a8d50686STom Rhodes.Xr xargs 1 ,
9529b50d902SRodney W. Grimes.Xr stat 2 ,
95353e87059STom Rhodes.Xr acl 3 ,
9549b50d902SRodney W. Grimes.Xr fts 3 ,
9559b50d902SRodney W. Grimes.Xr getgrent 3 ,
9569b50d902SRodney W. Grimes.Xr getpwent 3 ,
9579b50d902SRodney W. Grimes.Xr strmode 3 ,
95894ad6032SRuslan Ermilov.Xr re_format 7 ,
9599b50d902SRodney W. Grimes.Xr symlink 7
9609b50d902SRodney W. Grimes.Sh STANDARDS
9619b50d902SRodney W. GrimesThe
9628fe908efSRuslan Ermilov.Nm
9639b50d902SRodney W. Grimesutility syntax is a superset of the syntax specified by the
9641c832963SOliver Eikemeier.St -p1003.1-2001
9659b50d902SRodney W. Grimesstandard.
9669b50d902SRodney W. Grimes.Pp
9671c832963SOliver EikemeierAll the single character options except
968fbccd9dbSRuslan Ermilov.Fl H
9691c832963SOliver Eikemeierand
970fbccd9dbSRuslan Ermilov.Fl L
971659a728eSCeri Daviesas well as
972659a728eSCeri Davies.Ic -amin , -anewer , -cmin , -cnewer , -delete , -empty , -fstype ,
973659a728eSCeri Davies.Ic -iname , -inum , -iregex , -ls , -maxdepth , -mindepth , -mmin ,
974659a728eSCeri Davies.Ic -path , -print0 , -regex
975440a24d8SCeri Daviesand all of the
976fbccd9dbSRuslan Ermilov.Ic -B*
977440a24d8SCeri Daviesbirthtime related primaries are extensions to
9781c832963SOliver Eikemeier.St -p1003.1-2001 .
979f6e4fb22SSteve Price.Pp
9809b50d902SRodney W. GrimesHistorically, the
98147d91ba3SDag-Erling Smørgrav.Fl d , L
9829b50d902SRodney W. Grimesand
9839b50d902SRodney W. Grimes.Fl x
984bfd12208SRuslan Ermilovoptions were implemented using the primaries
985bfd12208SRuslan Ermilov.Ic -depth , -follow ,
986bfd12208SRuslan Ermilovand
987bfd12208SRuslan Ermilov.Ic -xdev .
9889b50d902SRodney W. GrimesThese primaries always evaluated to true.
9899b50d902SRodney W. GrimesAs they were really global variables that took effect before the traversal
9909b50d902SRodney W. Grimesbegan, some legal expressions could have unexpected results.
991bfd12208SRuslan ErmilovAn example is the expression
992bfd12208SRuslan Ermilov.Ic -print Cm -o Ic -depth .
993bfd12208SRuslan ErmilovAs
994bfd12208SRuslan Ermilov.Ic -print
995bfd12208SRuslan Ermilovalways evaluates to true, the standard order of evaluation
996bfd12208SRuslan Ermilovimplies that
997bfd12208SRuslan Ermilov.Ic -depth
998bfd12208SRuslan Ermilovwould never be evaluated.
9999b50d902SRodney W. GrimesThis is not the case.
10009b50d902SRodney W. Grimes.Pp
1001bfd12208SRuslan ErmilovThe operator
1002bfd12208SRuslan Ermilov.Cm -or
1003bfd12208SRuslan Ermilovwas implemented as
1004bfd12208SRuslan Ermilov.Cm -o ,
1005bfd12208SRuslan Ermilovand the operator
1006bfd12208SRuslan Ermilov.Cm -and
1007bfd12208SRuslan Ermilovwas implemented as
1008bfd12208SRuslan Ermilov.Cm -a .
10099b50d902SRodney W. Grimes.Pp
10109b50d902SRodney W. GrimesHistoric implementations of the
1011bfd12208SRuslan Ermilov.Ic -exec
10129b50d902SRodney W. Grimesand
1013bfd12208SRuslan Ermilov.Ic -ok
1014bfd12208SRuslan Ermilovprimaries did not replace the string
1015bfd12208SRuslan Ermilov.Dq Li {}
1016bfd12208SRuslan Ermilovin the utility name or the
10179b50d902SRodney W. Grimesutility arguments if it had preceding or following non-whitespace characters.
10189b50d902SRodney W. GrimesThis version replaces it no matter where in the utility name or arguments
10199b50d902SRodney W. Grimesit appears.
10207c1d4b3aSAkinori MUSHA.Pp
10217c1d4b3aSAkinori MUSHAThe
10227c1d4b3aSAkinori MUSHA.Fl E
102347d91ba3SDag-Erling Smørgravoption was inspired by the equivalent
10247c1d4b3aSAkinori MUSHA.Xr grep 1
10257c1d4b3aSAkinori MUSHAand
102647d91ba3SDag-Erling Smørgrav.Xr sed 1
102747d91ba3SDag-Erling Smørgravoptions.
1028ad487600SColin Percival.Sh HISTORY
1029ad487600SColin PercivalA
1030ad487600SColin Percival.Nm
1031ad487600SColin Percivalcommand appeared in
1032ad487600SColin Percival.At v1 .
10339b50d902SRodney W. Grimes.Sh BUGS
10349b50d902SRodney W. GrimesThe special characters used by
10358fe908efSRuslan Ermilov.Nm
10369b50d902SRodney W. Grimesare also special characters to many shell programs.
1037bfd12208SRuslan ErmilovIn particular, the characters
1038bfd12208SRuslan Ermilov.Dq Li * ,
1039bfd12208SRuslan Ermilov.Dq Li \&[ ,
1040bfd12208SRuslan Ermilov.Dq Li \&] ,
1041bfd12208SRuslan Ermilov.Dq Li \&? ,
1042bfd12208SRuslan Ermilov.Dq Li \&( ,
1043bfd12208SRuslan Ermilov.Dq Li \&) ,
1044bfd12208SRuslan Ermilov.Dq Li \&! ,
1045bfd12208SRuslan Ermilov.Dq Li \e
1046bfd12208SRuslan Ermilovand
1047bfd12208SRuslan Ermilov.Dq Li \&;
1048bfd12208SRuslan Ermilovmay have to be escaped from the shell.
10499b50d902SRodney W. Grimes.Pp
10509b50d902SRodney W. GrimesAs there is no delimiter separating options and file names or file
10519b50d902SRodney W. Grimesnames and the
10529b50d902SRodney W. Grimes.Ar expression ,
1053bfd12208SRuslan Ermilovit is difficult to specify files named
1054bfd12208SRuslan Ermilov.Pa -xdev
1055bfd12208SRuslan Ermilovor
1056bfd12208SRuslan Ermilov.Pa \&! .
10579b50d902SRodney W. GrimesThese problems are handled by the
10589b50d902SRodney W. Grimes.Fl f
10599b50d902SRodney W. Grimesoption and the
10609b50d902SRodney W. Grimes.Xr getopt 3
1061bfd12208SRuslan Ermilov.Dq Fl Fl
1062bfd12208SRuslan Ermilovconstruct.
1063abacbbbfSPeter Wemm.Pp
1064abacbbbfSPeter WemmThe
1065abacbbbfSPeter Wemm.Ic -delete
106656f7a840SBill Fumerolaprimary does not interact well with other options that cause the file system
1067abacbbbfSPeter Wemmtree traversal options to be changed.
1068ad487600SColin Percival.Pp
10694f45d811STim J. RobbinsThe
1070dfef91e9SColin Percival.Ic -mindepth
1071dfef91e9SColin Percivaland
1072dfef91e9SColin Percival.Ic -maxdepth
10732cb640f6SColin Percivalprimaries are actually global options (as documented above).
10742cb640f6SColin PercivalThey should
1075dfef91e9SColin Percivalprobably be replaced by options which look like options.
1076