xref: /freebsd/usr.bin/find/find.1 (revision 75e6f664c469927ca73ecd7b16a8058bc292a451)
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.
15fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
169b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
179b50d902SRodney W. Grimes.\"    without specific prior written permission.
189b50d902SRodney W. Grimes.\"
199b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
209b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
219b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
229b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
239b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
249b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
259b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
269b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
279b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
289b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
299b50d902SRodney W. Grimes.\" SUCH DAMAGE.
309b50d902SRodney W. Grimes.\"
31841484cdSPeter Wemm.\"	@(#)find.1	8.7 (Berkeley) 5/9/95
32c3aac50fSPeter Wemm.\" $FreeBSD$
339b50d902SRodney W. Grimes.\"
34*75e6f664SDaniel Ebdrup Jensen.Dd February 23, 2021
359b50d902SRodney W. Grimes.Dt FIND 1
369b50d902SRodney W. Grimes.Os
379b50d902SRodney W. Grimes.Sh NAME
389b50d902SRodney W. Grimes.Nm find
399b50d902SRodney W. Grimes.Nd walk a file hierarchy
409b50d902SRodney W. Grimes.Sh SYNOPSIS
418fe908efSRuslan Ermilov.Nm
429b50d902SRodney W. Grimes.Op Fl H | Fl L | Fl P
437c1d4b3aSAkinori MUSHA.Op Fl EXdsx
44dfab7fb1SRuslan Ermilov.Op Fl f Ar path
45dfab7fb1SRuslan Ermilov.Ar path ...
46dfab7fb1SRuslan Ermilov.Op Ar expression
47107f86a2SStefan Farfeleder.Nm
48107f86a2SStefan Farfeleder.Op Fl H | Fl L | Fl P
49107f86a2SStefan Farfeleder.Op Fl EXdsx
50dfab7fb1SRuslan Ermilov.Fl f Ar path
51dfab7fb1SRuslan Ermilov.Op Ar path ...
52dfab7fb1SRuslan Ermilov.Op Ar expression
539b50d902SRodney W. Grimes.Sh DESCRIPTION
54e8937ba0SPhilippe CharnierThe
55e8937ba0SPhilippe Charnier.Nm
56e8937ba0SPhilippe Charnierutility recursively descends the directory tree for each
57dfab7fb1SRuslan Ermilov.Ar path
589b50d902SRodney W. Grimeslisted, evaluating an
599b50d902SRodney W. Grimes.Ar expression
60bfd12208SRuslan Ermilov(composed of the
61bfd12208SRuslan Ermilov.Dq primaries
62bfd12208SRuslan Ermilovand
63bfd12208SRuslan Ermilov.Dq operands
64bfd12208SRuslan Ermilovlisted below) in terms
659b50d902SRodney W. Grimesof each file in the tree.
669b50d902SRodney W. Grimes.Pp
679b50d902SRodney W. GrimesThe options are as follows:
68bfd12208SRuslan Ermilov.Bl -tag -width indent
697c1d4b3aSAkinori MUSHA.It Fl E
707c1d4b3aSAkinori MUSHAInterpret regular expressions followed by
717c1d4b3aSAkinori MUSHA.Ic -regex
727c1d4b3aSAkinori MUSHAand
737c1d4b3aSAkinori MUSHA.Ic -iregex
74fbccd9dbSRuslan Ermilovprimaries as extended (modern) regular expressions rather than basic
75bfd12208SRuslan Ermilovregular expressions (BRE's).
76bfd12208SRuslan ErmilovThe
777c1d4b3aSAkinori MUSHA.Xr re_format 7
787c1d4b3aSAkinori MUSHAmanual page fully describes both formats.
799b50d902SRodney W. Grimes.It Fl H
803c94f41fSPhilippe CharnierCause the file information and file type (see
819b50d902SRodney W. Grimes.Xr stat 2 )
829b50d902SRodney W. Grimesreturned for each symbolic link specified on the command line to be
839b50d902SRodney W. Grimesthose of the file referenced by the link, not the link itself.
849b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will
856df69548SBruce Evansbe for the link itself.
866df69548SBruce EvansFile information of all symbolic links not on
879b50d902SRodney W. Grimesthe command line is that of the link itself.
889b50d902SRodney W. Grimes.It Fl L
893c94f41fSPhilippe CharnierCause the file information and file type (see
909b50d902SRodney W. Grimes.Xr stat 2 )
919b50d902SRodney W. Grimesreturned for each symbolic link to be those of the file referenced by the
929b50d902SRodney W. Grimeslink, not the link itself.
939b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will
949b50d902SRodney W. Grimesbe for the link itself.
9547d91ba3SDag-Erling Smørgrav.Pp
9647d91ba3SDag-Erling SmørgravThis option is equivalent to the deprecated
9747d91ba3SDag-Erling Smørgrav.Ic -follow
9847d91ba3SDag-Erling Smørgravprimary.
999b50d902SRodney W. Grimes.It Fl P
1003c94f41fSPhilippe CharnierCause the file information and file type (see
1019b50d902SRodney W. Grimes.Xr stat 2 )
1029b50d902SRodney W. Grimesreturned for each symbolic link to be those of the link itself.
1033d9a9402SJohn PolstraThis is the default.
1049b50d902SRodney W. Grimes.It Fl X
1053c94f41fSPhilippe CharnierPermit
1069b50d902SRodney W. Grimes.Nm
1079b50d902SRodney W. Grimesto be safely used in conjunction with
1089b50d902SRodney W. Grimes.Xr xargs 1 .
1099b50d902SRodney W. GrimesIf a file name contains any of the delimiting characters used by
110bfd12208SRuslan Ermilov.Xr xargs 1 ,
1119b50d902SRodney W. Grimesa diagnostic message is displayed on standard error, and the file
1129b50d902SRodney W. Grimesis skipped.
113bfd12208SRuslan ErmilovThe delimiting characters include single
114bfd12208SRuslan Ermilov.Pq Dq Li " ' "
115bfd12208SRuslan Ermilovand double
116bfd12208SRuslan Ermilov.Pq Dq Li " \*q "
117bfd12208SRuslan Ermilovquotes, backslash
118bfd12208SRuslan Ermilov.Pq Dq Li \e ,
119bfd12208SRuslan Ermilovspace, tab and newline characters.
120a8d50686STom Rhodes.Pp
121a8d50686STom RhodesHowever, you may wish to consider the
122a8d50686STom Rhodes.Fl print0
123a8d50686STom Rhodesprimary in conjunction with
124e2f8ed51SRuslan Ermilov.Dq Nm xargs Fl 0
125a8d50686STom Rhodesas an effective alternative.
1269b50d902SRodney W. Grimes.It Fl d
1273c94f41fSPhilippe CharnierCause
1288fe908efSRuslan Ermilov.Nm
129eb555785SJilles Tjoelkerto perform a depth-first traversal.
13047d91ba3SDag-Erling Smørgrav.Pp
131eb555785SJilles TjoelkerThis option is a BSD-specific equivalent of the
13247d91ba3SDag-Erling Smørgrav.Ic -depth
133eb555785SJilles Tjoelkerprimary specified by
1341c832963SOliver Eikemeier.St -p1003.1-2001 .
135eb555785SJilles TjoelkerRefer to its description under
136eb555785SJilles Tjoelker.Sx PRIMARIES
137eb555785SJilles Tjoelkerfor more information.
1386d0c7e13SWolfram Schneider.It Fl s
1393c94f41fSPhilippe CharnierCause
1408fe908efSRuslan Ermilov.Nm
1416df69548SBruce Evansto traverse the file hierarchies in lexicographical order,
1426df69548SBruce Evansi.e., alphabetical order within each directory.
1436df69548SBruce EvansNote:
144bfd12208SRuslan Ermilov.Ql find -s
1456d0c7e13SWolfram Schneiderand
146bfd12208SRuslan Ermilov.Ql "find | sort"
1476d0c7e13SWolfram Schneidermay give different results.
1489b50d902SRodney W. Grimes.It Fl x
1493c94f41fSPhilippe CharnierPrevent
1508fe908efSRuslan Ermilov.Nm
1519b50d902SRodney W. Grimesfrom descending into directories that have a device number different
1529b50d902SRodney W. Grimesthan that of the file from which the descent began.
15347d91ba3SDag-Erling Smørgrav.Pp
15447d91ba3SDag-Erling SmørgravThis option is equivalent to the deprecated
15547d91ba3SDag-Erling Smørgrav.Ic -xdev
15647d91ba3SDag-Erling Smørgravprimary.
1579b50d902SRodney W. Grimes.El
1589b50d902SRodney W. Grimes.Sh PRIMARIES
159be2cad28SGlen BarberAll primaries which take a numeric argument allow the number to be
160be2cad28SGlen Barberpreceded by a plus sign
161be2cad28SGlen Barber.Pq Dq Li +
162be2cad28SGlen Barberor a minus sign
163be2cad28SGlen Barber.Pq Dq Li - .
164be2cad28SGlen BarberA preceding plus sign means
165be2cad28SGlen Barber.Dq more than n ,
166be2cad28SGlen Barbera preceding minus sign means
167be2cad28SGlen Barber.Dq less than n
168be2cad28SGlen Barberand neither means
169be2cad28SGlen Barber.Dq exactly n .
170bfd12208SRuslan Ermilov.Bl -tag -width indent
17131d53425SCeri Davies.It Ic -Bmin Ar n
17231d53425SCeri DaviesTrue if the difference between the time of a file's inode creation
17331d53425SCeri Daviesand the time
17431d53425SCeri Davies.Nm
17531d53425SCeri Davieswas started, rounded up to the next full minute, is
17631d53425SCeri Davies.Ar n
17731d53425SCeri Daviesminutes.
17831d53425SCeri Davies.It Ic -Bnewer Ar file
17931d53425SCeri DaviesSame as
18031d53425SCeri Davies.Ic -newerBm .
18131d53425SCeri Davies.It Ic -Btime Ar n Ns Op Cm smhdw
18231d53425SCeri DaviesIf no units are specified, this primary evaluates to
18331d53425SCeri Daviestrue if the difference between the time of a file's inode creation
18431d53425SCeri Daviesand the time
18531d53425SCeri Davies.Nm
18631d53425SCeri Davieswas started, rounded up to the next full 24-hour period, is
18731d53425SCeri Davies.Ar n
18831d53425SCeri Davies24-hour periods.
18931d53425SCeri Davies.Pp
19031d53425SCeri DaviesIf units are specified, this primary evaluates to
1913b0fbd31SRuslan Ermilovtrue if the difference between the time of a file's inode creation
1923b0fbd31SRuslan Ermilovand the time
19331d53425SCeri Davies.Nm
19431d53425SCeri Davieswas started is exactly
19531d53425SCeri Davies.Ar n
19631d53425SCeri Daviesunits.
19731d53425SCeri DaviesPlease refer to the
19831d53425SCeri Davies.Ic -atime
19931d53425SCeri Daviesprimary description for information on supported time units.
20053e87059STom Rhodes.It Ic -acl
201fbccd9dbSRuslan ErmilovMay be used in conjunction with other primaries to locate
20253e87059STom Rhodesfiles with extended ACLs.
20353e87059STom RhodesSee
20453e87059STom Rhodes.Xr acl 3
20553e87059STom Rhodesfor more information.
206115b335eSEitan Adler.It Ic -amin Oo Cm - Ns | Ns Cm + Oc Ns Ar n
2073f5223f8SWolfram SchneiderTrue if the difference between the file last access time and the time
2088fe908efSRuslan Ermilov.Nm
20945fe9882SMatthew Huntwas started, rounded up to the next full minute, is
210115b335eSEitan Adlermore than
2113f5223f8SWolfram Schneider.Ar n
212115b335eSEitan Adler.Pq + Ns Ar n ,
213115b335eSEitan Adlerless than
214115b335eSEitan Adler.Ar n
215115b335eSEitan Adler.Pq - Ns Ar n ,
216115b335eSEitan Adleror exactly
217115b335eSEitan Adler.Ar n
218115b335eSEitan Adlerminutes ago.
219ea92232aSPoul-Henning Kamp.It Ic -anewer Ar file
220ea92232aSPoul-Henning KampSame as
221ea92232aSPoul-Henning Kamp.Ic -neweram .
222adff4fcaSRuslan Ermilov.It Ic -atime Ar n Ns Op Cm smhdw
223adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to
224adff4fcaSRuslan Ermilovtrue if the difference between the file last access time and the time
2258fe908efSRuslan Ermilov.Nm
22654874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is
2279b50d902SRodney W. Grimes.Ar n
22854874bb6SRuslan Ermilov24-hour periods.
229adff4fcaSRuslan Ermilov.Pp
230adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to
231adff4fcaSRuslan Ermilovtrue if the difference between the file last access time and the time
232adff4fcaSRuslan Ermilov.Nm
233adff4fcaSRuslan Ermilovwas started is exactly
234adff4fcaSRuslan Ermilov.Ar n
235adff4fcaSRuslan Ermilovunits.
236adff4fcaSRuslan ErmilovPossible time units are as follows:
237adff4fcaSRuslan Ermilov.Pp
238adff4fcaSRuslan Ermilov.Bl -tag -width indent -compact
239adff4fcaSRuslan Ermilov.It Cm s
240adff4fcaSRuslan Ermilovsecond
241adff4fcaSRuslan Ermilov.It Cm m
242adff4fcaSRuslan Ermilovminute (60 seconds)
243adff4fcaSRuslan Ermilov.It Cm h
244adff4fcaSRuslan Ermilovhour (60 minutes)
245adff4fcaSRuslan Ermilov.It Cm d
246adff4fcaSRuslan Ermilovday (24 hours)
247adff4fcaSRuslan Ermilov.It Cm w
248adff4fcaSRuslan Ermilovweek (7 days)
249adff4fcaSRuslan Ermilov.El
250adff4fcaSRuslan Ermilov.Pp
251adff4fcaSRuslan ErmilovAny number of units may be combined in one
252adff4fcaSRuslan Ermilov.Ic -atime
253adff4fcaSRuslan Ermilovargument, for example,
254adff4fcaSRuslan Ermilov.Dq Li "-atime -1h30m" .
255adff4fcaSRuslan ErmilovUnits are probably only useful when used in conjunction with the
256adff4fcaSRuslan Ermilov.Cm +
257adff4fcaSRuslan Ermilovor
258adff4fcaSRuslan Ermilov.Cm -
259adff4fcaSRuslan Ermilovmodifier.
260115b335eSEitan Adler.It Ic -cmin Oo Cm - Ns | Ns Cm + Oc Ns Ar n
2613f5223f8SWolfram SchneiderTrue if the difference between the time of last change of file status
2623f5223f8SWolfram Schneiderinformation and the time
2638fe908efSRuslan Ermilov.Nm
26445fe9882SMatthew Huntwas started, rounded up to the next full minute, is
265115b335eSEitan Adlermore than
2663f5223f8SWolfram Schneider.Ar n
267115b335eSEitan Adler.Pq + Ns Ar n ,
268115b335eSEitan Adlerless than
269115b335eSEitan Adler.Ar n
270115b335eSEitan Adler.Pq - Ns Ar n ,
271115b335eSEitan Adleror exactly
272115b335eSEitan Adler.Ar n
273115b335eSEitan Adlerminutes ago.
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
297a8622446SIsabell LongNon-portable, BSD-specific version of
29846b993ffSWarner Losh.Ic depth .
29946b993ffSWarner LoshGNU find implements this as a primary in mistaken emulation of
30046b993ffSWarner Losh.Fx
30181b295a1SEitan Adler.Nm .
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.
3155102783bSEitan AdlerThe
3165102783bSEitan Adler.Ic -delete
3175102783bSEitan Adlerprimary will fail to delete a directory if it is not empty.
318a05cb852SJilles TjoelkerFollowing symlinks is incompatible with this option.
3199b4e871aSDavid E. O'Brien.It Ic -depth
3209b4e871aSDavid E. O'BrienAlways true;
321a8622446SIsabell Longsame as the non-portable
3229b4e871aSDavid E. O'Brien.Fl d
323eb555785SJilles Tjoelkeroption.
324eb555785SJilles TjoelkerCause
325eb555785SJilles Tjoelker.Nm
326eb555785SJilles Tjoelkerto perform a depth-first traversal, i.e., directories
327eb555785SJilles Tjoelkerare visited in post-order and all entries in a directory will be acted
328eb555785SJilles Tjoelkeron before the directory itself.
329eb555785SJilles TjoelkerBy default,
330eb555785SJilles Tjoelker.Nm
331eb555785SJilles Tjoelkervisits directories in pre-order, i.e., before their contents.
332eb555785SJilles TjoelkerNote, the default is
333eb555785SJilles Tjoelker.Em not
334eb555785SJilles Tjoelkera breadth-first traversal.
335eb555785SJilles Tjoelker.Pp
336eb555785SJilles TjoelkerThe
337eb555785SJilles Tjoelker.Ic -depth
338eb555785SJilles Tjoelkerprimary
339eb555785SJilles Tjoelkercan be useful when
340eb555785SJilles Tjoelker.Nm
341eb555785SJilles Tjoelkeris used with
342eb555785SJilles Tjoelker.Xr cpio 1
343eb555785SJilles Tjoelkerto process files that are contained in directories with unusual permissions.
344eb555785SJilles TjoelkerIt ensures that you have write permission while you are placing files in a
345eb555785SJilles Tjoelkerdirectory, then sets the directory's permissions as the last thing.
3461c832963SOliver Eikemeier.It Ic -depth Ar n
3471c832963SOliver EikemeierTrue if the depth of the file relative to the starting point of the traversal
3481c832963SOliver Eikemeieris
3491c832963SOliver Eikemeier.Ar n .
350ed1a4621SPeter Wemm.It Ic -empty
351ed1a4621SPeter WemmTrue if the current file or directory is empty.
352c93e83feSRuslan Ermilov.It Ic -exec Ar utility Oo Ar argument ... Oc Li \&;
3539b50d902SRodney W. GrimesTrue if the program named
3549b50d902SRodney W. Grimes.Ar utility
3559b50d902SRodney W. Grimesreturns a zero value as its exit status.
356bfd12208SRuslan ErmilovOptional
357bfd12208SRuslan Ermilov.Ar arguments
358bfd12208SRuslan Ermilovmay be passed to the utility.
359bfd12208SRuslan ErmilovThe expression must be terminated by a semicolon
360bfd12208SRuslan Ermilov.Pq Dq Li \&; .
3616a2b59f8SJens SchweikhardtIf you invoke
3626a2b59f8SJens Schweikhardt.Nm
3636a2b59f8SJens Schweikhardtfrom a shell you may need to quote the semicolon if the shell would
3646a2b59f8SJens Schweikhardtotherwise treat it as a control operator.
365bfd12208SRuslan ErmilovIf the string
366bfd12208SRuslan Ermilov.Dq Li {}
367bfd12208SRuslan Ermilovappears anywhere in the utility name or the
3689b50d902SRodney W. Grimesarguments it is replaced by the pathname of the current file.
3699b50d902SRodney W. Grimes.Ar Utility
3709b50d902SRodney W. Grimeswill be executed from the directory from which
3718fe908efSRuslan Ermilov.Nm
3729b50d902SRodney W. Grimeswas executed.
37308274979SYaroslav Tykhiy.Ar Utility
37408274979SYaroslav Tykhiyand
37508274979SYaroslav Tykhiy.Ar arguments
37608274979SYaroslav Tykhiyare not subject to the further expansion of shell patterns
37708274979SYaroslav Tykhiyand constructs.
378c93e83feSRuslan Ermilov.It Ic -exec Ar utility Oo Ar argument ... Oc Li {} +
3795e25d888STim J. RobbinsSame as
3805e25d888STim J. Robbins.Ic -exec ,
3815e25d888STim J. Robbinsexcept that
3825e25d888STim J. Robbins.Dq Li {}
3835e25d888STim J. Robbinsis replaced with as many pathnames as possible for each invocation of
3845e25d888STim J. Robbins.Ar utility .
3855e25d888STim J. RobbinsThis behaviour is similar to that of
3865e25d888STim J. Robbins.Xr xargs 1 .
3877a79617cSJilles TjoelkerThe primary always returns true;
3887a79617cSJilles Tjoelkerif at least one invocation of
3897a79617cSJilles Tjoelker.Ar utility
3907a79617cSJilles Tjoelkerreturns a non-zero exit status,
3917a79617cSJilles Tjoelker.Nm
3927a79617cSJilles Tjoelkerwill return a non-zero exit status.
393c93e83feSRuslan Ermilov.It Ic -execdir Ar utility Oo Ar argument ... Oc Li \&;
394127d7563SWarner LoshThe
395bfd12208SRuslan Ermilov.Ic -execdir
396127d7563SWarner Loshprimary is identical to the
397127d7563SWarner Losh.Ic -exec
398127d7563SWarner Loshprimary with the exception that
399bfd12208SRuslan Ermilov.Ar utility
400127d7563SWarner Loshwill be executed from the directory that holds
4016df69548SBruce Evansthe current file.
4026df69548SBruce EvansThe filename substituted for
403bfd12208SRuslan Ermilovthe string
404bfd12208SRuslan Ermilov.Dq Li {}
405bfd12208SRuslan Ermilovis not qualified.
40646b993ffSWarner Losh.It Ic -execdir Ar utility Oo Ar argument ... Oc Li {} +
40746b993ffSWarner LoshSame as
40846b993ffSWarner Losh.Ic -execdir ,
40946b993ffSWarner Loshexcept that
41046b993ffSWarner Losh.Dq Li {}
41146b993ffSWarner Loshis replaced with as many pathnames as possible for each invocation of
41246b993ffSWarner Losh.Ar utility .
41346b993ffSWarner LoshThis behaviour is similar to that of
41446b993ffSWarner Losh.Xr xargs 1 .
4157a79617cSJilles TjoelkerThe primary always returns true;
4167a79617cSJilles Tjoelkerif at least one invocation of
4177a79617cSJilles Tjoelker.Ar utility
4187a79617cSJilles Tjoelkerreturns a non-zero exit status,
4197a79617cSJilles Tjoelker.Nm
4207a79617cSJilles Tjoelkerwill return a non-zero exit status.
4217fd5ee41SRuslan Ermilov.It Ic -flags Oo Cm - Ns | Ns Cm + Oc Ns Ar flags , Ns Ar notflags
4227fd5ee41SRuslan ErmilovThe flags are specified using symbolic names (see
423208691fcSRuslan Ermilov.Xr chflags 1 ) .
4247fd5ee41SRuslan ErmilovThose with the
4257fd5ee41SRuslan Ermilov.Qq Li no
4267fd5ee41SRuslan Ermilovprefix (except
4277fd5ee41SRuslan Ermilov.Qq Li nodump )
4287fd5ee41SRuslan Ermilovare said to be
4297fd5ee41SRuslan Ermilov.Ar notflags .
4307fd5ee41SRuslan ErmilovFlags in
4317fd5ee41SRuslan Ermilov.Ar flags
4327fd5ee41SRuslan Ermilovare checked to be set, and flags in
4337fd5ee41SRuslan Ermilov.Ar notflags
4347fd5ee41SRuslan Ermilovare checked to be not set.
435208691fcSRuslan ErmilovNote that this is different from
436208691fcSRuslan Ermilov.Ic -perm ,
4377fd5ee41SRuslan Ermilovwhich only allows the user to specify mode bits that are set.
4387fd5ee41SRuslan Ermilov.Pp
4397fd5ee41SRuslan ErmilovIf flags are preceded by a dash
4407fd5ee41SRuslan Ermilov.Pq Dq Li - ,
4417fd5ee41SRuslan Ermilovthis primary evaluates to true
4427fd5ee41SRuslan Ermilovif at least all of the bits in
4437fd5ee41SRuslan Ermilov.Ar flags
4447fd5ee41SRuslan Ermilovand none of the bits in
4457fd5ee41SRuslan Ermilov.Ar notflags
4467fd5ee41SRuslan Ermilovare set in the file's flags bits.
4477fd5ee41SRuslan ErmilovIf flags are preceded by a plus
4487fd5ee41SRuslan Ermilov.Pq Dq Li + ,
4497fd5ee41SRuslan Ermilovthis primary evaluates to true
4507fd5ee41SRuslan Ermilovif any of the bits in
4517fd5ee41SRuslan Ermilov.Ar flags
4527fd5ee41SRuslan Ermilovis set in the file's flags bits,
4537fd5ee41SRuslan Ermilovor any of the bits in
4547fd5ee41SRuslan Ermilov.Ar notflags
4557fd5ee41SRuslan Ermilovis not set in the file's flags bits.
4567fd5ee41SRuslan ErmilovOtherwise,
4577fd5ee41SRuslan Ermilovthis primary evaluates to true
4587fd5ee41SRuslan Ermilovif the bits in
4597fd5ee41SRuslan Ermilov.Ar flags
4607fd5ee41SRuslan Ermilovexactly match the file's flags bits,
4617fd5ee41SRuslan Ermilovand none of the
4627fd5ee41SRuslan Ermilov.Ar flags
4637fd5ee41SRuslan Ermilovbits match those of
4647fd5ee41SRuslan Ermilov.Ar notflags .
4659b50d902SRodney W. Grimes.It Ic -fstype Ar type
4669b50d902SRodney W. GrimesTrue if the file is contained in a file system of type
4679b50d902SRodney W. Grimes.Ar type .
468841484cdSPeter WemmThe
469d740b7c7SPawel Jakub Dawidek.Xr lsvfs 1
470841484cdSPeter Wemmcommand can be used to find out the types of file systems
471d740b7c7SPawel Jakub Dawidekthat are available on the system.
472bfd12208SRuslan ErmilovIn addition, there are two pseudo-types,
473bfd12208SRuslan Ermilov.Dq Li local
474bfd12208SRuslan Ermilovand
475bfd12208SRuslan Ermilov.Dq Li rdonly .
4769b50d902SRodney W. GrimesThe former matches any file system physically mounted on the system where
4779b50d902SRodney W. Grimesthe
4788fe908efSRuslan Ermilov.Nm
4799b50d902SRodney W. Grimesis being executed and the latter matches any file system which is
4809b50d902SRodney W. Grimesmounted read-only.
48146b993ffSWarner Losh.It Ic -gid Ar gname
48246b993ffSWarner LoshThe same thing as
48393e0e298SMateusz Piotrowski.Ic -group Ar gname
48446b993ffSWarner Loshfor compatibility with GNU find.
48546b993ffSWarner LoshGNU find imposes a restriction that
48646b993ffSWarner Losh.Ar gname
48746b993ffSWarner Loshis numeric, while
48881b295a1SEitan Adler.Nm
48946b993ffSWarner Loshdoes not.
4909b50d902SRodney W. Grimes.It Ic -group Ar gname
4919b50d902SRodney W. GrimesTrue if the file belongs to the group
4929b50d902SRodney W. Grimes.Ar gname .
4939b50d902SRodney W. GrimesIf
4949b50d902SRodney W. Grimes.Ar gname
4959b50d902SRodney W. Grimesis numeric and there is no such group name, then
4969b50d902SRodney W. Grimes.Ar gname
497bfd12208SRuslan Ermilovis treated as a group ID.
49846b993ffSWarner Losh.It Ic -ignore_readdir_race
49940072dc2SJilles TjoelkerIgnore errors because a file or a directory is deleted
50040072dc2SJilles Tjoelkerafter reading the name from a directory.
50140072dc2SJilles TjoelkerThis option does not affect errors occurring on starting points.
50246b993ffSWarner Losh.It Ic -ilname Ar pattern
50346b993ffSWarner LoshLike
50446b993ffSWarner Losh.Ic -lname ,
50546b993ffSWarner Loshbut the match is case insensitive.
506a66a6a2aSWarner LoshThis is a GNU find extension.
507208691fcSRuslan Ermilov.It Ic -iname Ar pattern
508208691fcSRuslan ErmilovLike
509208691fcSRuslan Ermilov.Ic -name ,
510208691fcSRuslan Ermilovbut the match is case insensitive.
5119b50d902SRodney W. Grimes.It Ic -inum Ar n
5129b50d902SRodney W. GrimesTrue if the file has inode number
5139b50d902SRodney W. Grimes.Ar n .
514208691fcSRuslan Ermilov.It Ic -ipath Ar pattern
515208691fcSRuslan ErmilovLike
516208691fcSRuslan Ermilov.Ic -path ,
517208691fcSRuslan Ermilovbut the match is case insensitive.
518208691fcSRuslan Ermilov.It Ic -iregex Ar pattern
519208691fcSRuslan ErmilovLike
520208691fcSRuslan Ermilov.Ic -regex ,
521208691fcSRuslan Ermilovbut the match is case insensitive.
52246b993ffSWarner Losh.It Ic -iwholename Ar pattern
52346b993ffSWarner LoshThe same thing as
52446b993ffSWarner Losh.Ic -ipath ,
52546b993ffSWarner Loshfor GNU find compatibility.
5269b50d902SRodney W. Grimes.It Ic -links Ar n
5279b50d902SRodney W. GrimesTrue if the file has
5289b50d902SRodney W. Grimes.Ar n
5299b50d902SRodney W. Grimeslinks.
53046b993ffSWarner Losh.It Ic -lname Ar pattern
53146b993ffSWarner LoshLike
53246b993ffSWarner Losh.Ic -name ,
533a66a6a2aSWarner Loshbut the contents of the symbolic link are matched instead of the file
534a66a6a2aSWarner Loshname.
535e810bef7SJilles TjoelkerNote that this only matches broken symbolic links
536e810bef7SJilles Tjoelkerif symbolic links are being followed.
537a66a6a2aSWarner LoshThis is a GNU find extension.
5389b50d902SRodney W. Grimes.It Ic -ls
5399b50d902SRodney W. GrimesThis primary always evaluates to true.
5409b50d902SRodney W. GrimesThe following information for the current file is written to standard output:
54154874bb6SRuslan Ermilovits inode number, size in 512-byte blocks, file permissions, number of hard
5429b50d902SRodney W. Grimeslinks, owner, group, size in bytes, last modification time, and pathname.
5439f365aa1SEd SchoutenIf the file is a block or character special file, the device number
5449b50d902SRodney W. Grimeswill be displayed instead of the size in bytes.
54554874bb6SRuslan ErmilovIf the file is a symbolic link, the pathname of the linked-to file will be
546bfd12208SRuslan Ermilovdisplayed preceded by
547bfd12208SRuslan Ermilov.Dq Li -> .
548bfd12208SRuslan ErmilovThe format is identical to that produced by
549bfd12208SRuslan Ermilov.Bk -words
550fbccd9dbSRuslan Ermilov.Dq Nm ls Fl dgils .
551bfd12208SRuslan Ermilov.Ek
552c76bc8f3SOllivier Robert.It Ic -maxdepth Ar n
5539c61111dSOliver EikemeierAlways true; descend at most
5549c61111dSOliver Eikemeier.Ar n
5559c61111dSOliver Eikemeierdirectory levels below the command line arguments.
556d79829afSOliver EikemeierIf any
557d79829afSOliver Eikemeier.Ic -maxdepth
558d79829afSOliver Eikemeierprimary is specified, it applies to the entire expression even if it would
559d79829afSOliver Eikemeiernot normally be evaluated.
560fbccd9dbSRuslan Ermilov.Dq Ic -maxdepth Li 0
561d79829afSOliver Eikemeierlimits the whole search to the command line arguments.
562c76bc8f3SOllivier Robert.It Ic -mindepth Ar n
5639c61111dSOliver EikemeierAlways true; do not apply any tests or actions at levels less than
5649c61111dSOliver Eikemeier.Ar n .
565d79829afSOliver EikemeierIf any
566d79829afSOliver Eikemeier.Ic -mindepth
567d79829afSOliver Eikemeierprimary is specified, it applies to the entire expression even if it would
568d79829afSOliver Eikemeiernot normally be evaluated.
569fbccd9dbSRuslan Ermilov.Dq Ic -mindepth Li 1
570d79829afSOliver Eikemeierprocesses all but the command line arguments.
571115b335eSEitan Adler.It Ic -mmin Oo Cm - Ns | Ns Cm + Oc Ns Ar n
5723f5223f8SWolfram SchneiderTrue if the difference between the file last modification time and the time
5738fe908efSRuslan Ermilov.Nm
57445fe9882SMatthew Huntwas started, rounded up to the next full minute, is
57516ce602cSSevan Janiyanmore than
5763f5223f8SWolfram Schneider.Ar n
577115b335eSEitan Adler.Pq + Ns Ar n ,
578115b335eSEitan Adlerless than
579115b335eSEitan Adler.Ar n
580115b335eSEitan Adler.Pq - Ns Ar n ,
581115b335eSEitan Adleror exactly
582115b335eSEitan Adler.Ar n
583115b335eSEitan Adlerminutes ago.
584208691fcSRuslan Ermilov.It Ic -mnewer Ar file
585208691fcSRuslan ErmilovSame as
586208691fcSRuslan Ermilov.Ic -newer .
58746b993ffSWarner Losh.It Ic -mount
58846b993ffSWarner LoshThe same thing as
58946b993ffSWarner Losh.Ic -xdev ,
59046b993ffSWarner Loshfor GNU find compatibility.
591adff4fcaSRuslan Ermilov.It Ic -mtime Ar n Ns Op Cm smhdw
592adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to
593adff4fcaSRuslan Ermilovtrue if the difference between the file last modification time and the time
5948fe908efSRuslan Ermilov.Nm
59554874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is
5969b50d902SRodney W. Grimes.Ar n
59754874bb6SRuslan Ermilov24-hour periods.
598adff4fcaSRuslan Ermilov.Pp
599adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to
600adff4fcaSRuslan Ermilovtrue if the difference between the file last modification time and the time
601adff4fcaSRuslan Ermilov.Nm
602adff4fcaSRuslan Ermilovwas started is exactly
603adff4fcaSRuslan Ermilov.Ar n
604adff4fcaSRuslan Ermilovunits.
605adff4fcaSRuslan ErmilovPlease refer to the
606adff4fcaSRuslan Ermilov.Ic -atime
607adff4fcaSRuslan Ermilovprimary description for information on supported time units.
6089b50d902SRodney W. Grimes.It Ic -name Ar pattern
6099b50d902SRodney W. GrimesTrue if the last component of the pathname being examined matches
6109b50d902SRodney W. Grimes.Ar pattern .
611bfd12208SRuslan ErmilovSpecial shell pattern matching characters
612bfd12208SRuslan Ermilov.Dq ( Li \&[ ,
613bfd12208SRuslan Ermilov.Dq Li \&] ,
614bfd12208SRuslan Ermilov.Dq Li * ,
615bfd12208SRuslan Ermilovand
616bfd12208SRuslan Ermilov.Dq Li \&? )
6179b50d902SRodney W. Grimesmay be used as part of
6189b50d902SRodney W. Grimes.Ar pattern .
6199b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a
620bfd12208SRuslan Ermilovbackslash
621bfd12208SRuslan Ermilov.Pq Dq Li \e .
6229b50d902SRodney W. Grimes.It Ic -newer Ar file
6239b50d902SRodney W. GrimesTrue if the current file has a more recent last modification time than
6249b50d902SRodney W. Grimes.Ar file .
625bfd12208SRuslan Ermilov.It Ic -newer Ns Ar X Ns Ar Y Ar file
626bfd12208SRuslan ErmilovTrue if the current file has a more recent last access time
627fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm a ,
62831d53425SCeri Daviesinode creation time
629fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm B ,
630bfd12208SRuslan Ermilovchange time
631fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm c ,
632bfd12208SRuslan Ermilovor modification time
633fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm m
634bfd12208SRuslan Ermilovthan the last access time
635fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm a ,
63631d53425SCeri Daviesinode creation time
637fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm B ,
638bfd12208SRuslan Ermilovchange time
639fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm c ,
640bfd12208SRuslan Ermilovor modification time
641fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm m
642bfd12208SRuslan Ermilovof
643ea92232aSPoul-Henning Kamp.Ar file .
644ea92232aSPoul-Henning KampIn addition, if
645bfd12208SRuslan Ermilov.Ar Y Ns = Ns Cm t ,
646ea92232aSPoul-Henning Kampthen
647ea92232aSPoul-Henning Kamp.Ar file
648ea92232aSPoul-Henning Kampis instead interpreted as a direct date specification of the form
649ea92232aSPoul-Henning Kampunderstood by
650ea92232aSPoul-Henning Kamp.Xr cvs 1 .
651ea92232aSPoul-Henning KampNote that
652ea92232aSPoul-Henning Kamp.Ic -newermm
653ea92232aSPoul-Henning Kampis equivalent to
654ea92232aSPoul-Henning Kamp.Ic -newer .
6559b50d902SRodney W. Grimes.It Ic -nogroup
6569b50d902SRodney W. GrimesTrue if the file belongs to an unknown group.
65746b993ffSWarner Losh.It Ic -noignore_readdir_race
65840072dc2SJilles TjoelkerTurn off the effect of
65940072dc2SJilles Tjoelker.Ic -ignore_readdir_race .
66040072dc2SJilles TjoelkerThis is default behaviour.
66146b993ffSWarner Losh.It Ic -noleaf
66246b993ffSWarner LoshThis option is for GNU find compatibility.
66346b993ffSWarner LoshIn GNU find it disables an optimization not relevant to
66481b295a1SEitan Adler.Nm ,
66546b993ffSWarner Loshso it is ignored.
666208691fcSRuslan Ermilov.It Ic -nouser
667208691fcSRuslan ErmilovTrue if the file belongs to an unknown user.
668c93e83feSRuslan Ermilov.It Ic -ok Ar utility Oo Ar argument ... Oc Li \&;
669208691fcSRuslan ErmilovThe
670208691fcSRuslan Ermilov.Ic -ok
671208691fcSRuslan Ermilovprimary is identical to the
672208691fcSRuslan Ermilov.Ic -exec
673208691fcSRuslan Ermilovprimary with the exception that
674208691fcSRuslan Ermilov.Nm
675208691fcSRuslan Ermilovrequests user affirmation for the execution of the
676208691fcSRuslan Ermilov.Ar utility
677208691fcSRuslan Ermilovby printing
678208691fcSRuslan Ermilova message to the terminal and reading a response.
67939c59153SRuslan ErmilovIf the response is not affirmative
68039c59153SRuslan Ermilov.Ql ( y
681ef6c7764STim J. Robbinsin the
682ef6c7764STim J. Robbins.Dq Li POSIX
683ef6c7764STim J. Robbinslocale),
684208691fcSRuslan Ermilovthe command is not executed and the
685208691fcSRuslan Ermilovvalue of the
686208691fcSRuslan Ermilov.Ic -ok
687208691fcSRuslan Ermilovexpression is false.
688c93e83feSRuslan Ermilov.It Ic -okdir Ar utility Oo Ar argument ... Oc Li \&;
689208691fcSRuslan ErmilovThe
690208691fcSRuslan Ermilov.Ic -okdir
691208691fcSRuslan Ermilovprimary is identical to the
692208691fcSRuslan Ermilov.Ic -execdir
693208691fcSRuslan Ermilovprimary with the same exception as described for the
694208691fcSRuslan Ermilov.Ic -ok
695208691fcSRuslan Ermilovprimary.
6969b50d902SRodney W. Grimes.It Ic -path Ar pattern
6979b50d902SRodney W. GrimesTrue if the pathname being examined matches
6989b50d902SRodney W. Grimes.Ar pattern .
699bfd12208SRuslan ErmilovSpecial shell pattern matching characters
700bfd12208SRuslan Ermilov.Dq ( Li \&[ ,
701bfd12208SRuslan Ermilov.Dq Li \&] ,
702bfd12208SRuslan Ermilov.Dq Li * ,
703bfd12208SRuslan Ermilovand
704bfd12208SRuslan Ermilov.Dq Li \&? )
7059b50d902SRodney W. Grimesmay be used as part of
7069b50d902SRodney W. Grimes.Ar pattern .
7079b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a
708bfd12208SRuslan Ermilovbackslash
709bfd12208SRuslan Ermilov.Pq Dq Li \e .
710bfd12208SRuslan ErmilovSlashes
711bfd12208SRuslan Ermilov.Pq Dq Li /
712bfd12208SRuslan Ermilovare treated as normal characters and do not have to be
7139b50d902SRodney W. Grimesmatched explicitly.
7147fd5ee41SRuslan Ermilov.It Ic -perm Oo Cm - Ns | Ns Cm + Oc Ns Ar mode
7159b50d902SRodney W. GrimesThe
7169b50d902SRodney W. Grimes.Ar mode
7179b50d902SRodney W. Grimesmay be either symbolic (see
7189b50d902SRodney W. Grimes.Xr chmod 1 )
7199b50d902SRodney W. Grimesor an octal number.
7207fd5ee41SRuslan ErmilovIf the
7217fd5ee41SRuslan Ermilov.Ar mode
7227fd5ee41SRuslan Ermilovis symbolic, a starting value of zero is assumed and the
7237fd5ee41SRuslan Ermilov.Ar mode
7247fd5ee41SRuslan Ermilovsets or clears permissions without regard to the process' file mode
7259b50d902SRodney W. Grimescreation mask.
7267fd5ee41SRuslan ErmilovIf the
7277fd5ee41SRuslan Ermilov.Ar mode
7287fd5ee41SRuslan Ermilovis octal, only bits 07777
729bfd12208SRuslan Ermilov.Pq Dv S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO
7309b50d902SRodney W. Grimesof the file's mode bits participate
7319b50d902SRodney W. Grimesin the comparison.
7327fd5ee41SRuslan ErmilovIf the
7337fd5ee41SRuslan Ermilov.Ar mode
7347fd5ee41SRuslan Ermilovis preceded by a dash
735bfd12208SRuslan Ermilov.Pq Dq Li - ,
7369b88faecSRuslan Ermilovthis primary evaluates to true
7377fd5ee41SRuslan Ermilovif at least all of the bits in the
7387fd5ee41SRuslan Ermilov.Ar mode
7397fd5ee41SRuslan Ermilovare set in the file's mode bits.
7407fd5ee41SRuslan ErmilovIf the
7417fd5ee41SRuslan Ermilov.Ar mode
7427fd5ee41SRuslan Ermilovis preceded by a plus
743bfd12208SRuslan Ermilov.Pq Dq Li + ,
7449b88faecSRuslan Ermilovthis primary evaluates to true
7457fd5ee41SRuslan Ermilovif any of the bits in the
7467fd5ee41SRuslan Ermilov.Ar mode
7477fd5ee41SRuslan Ermilovare set in the file's mode bits.
7489d2796c3SOllivier RobertOtherwise, this primary evaluates to true if
7497fd5ee41SRuslan Ermilovthe bits in the
7507fd5ee41SRuslan Ermilov.Ar mode
7517fd5ee41SRuslan Ermilovexactly match the file's mode bits.
752bfd12208SRuslan ErmilovNote, the first character of a symbolic mode may not be a dash
753bfd12208SRuslan Ermilov.Pq Dq Li - .
7549b50d902SRodney W. Grimes.It Ic -print
7559b50d902SRodney W. GrimesThis primary always evaluates to true.
7569b50d902SRodney W. GrimesIt prints the pathname of the current file to standard output.
757841484cdSPeter WemmIf none of
758bfd12208SRuslan Ermilov.Ic -exec , -ls , -print0 ,
7599b50d902SRodney W. Grimesor
760bfd12208SRuslan Ermilov.Ic -ok
761841484cdSPeter Wemmis specified, the given expression shall be effectively replaced by
762bfd12208SRuslan Ermilov.Cm \&( Ar "given expression" Cm \&) Ic -print .
7637cd23434SGarrett Wollman.It Ic -print0
7647cd23434SGarrett WollmanThis primary always evaluates to true.
765fbe0d04aSMasafumi Max NAKANEIt prints the pathname of the current file to standard output, followed by an
766cb29445aSRuslan Ermilov.Tn ASCII
767cb29445aSRuslan Ermilov.Dv NUL
7687cd23434SGarrett Wollmancharacter (character code 0).
7699b50d902SRodney W. Grimes.It Ic -prune
7709b50d902SRodney W. GrimesThis primary always evaluates to true.
7719b50d902SRodney W. GrimesIt causes
7728fe908efSRuslan Ermilov.Nm
7739b50d902SRodney W. Grimesto not descend into the current file.
7749b50d902SRodney W. GrimesNote, the
7759b50d902SRodney W. Grimes.Ic -prune
7769b50d902SRodney W. Grimesprimary has no effect if the
7779b50d902SRodney W. Grimes.Fl d
7789b50d902SRodney W. Grimesoption was specified.
7799168a75aSDag-Erling Smørgrav.It Ic -quit
7809168a75aSDag-Erling SmørgravCauses
7819168a75aSDag-Erling Smørgrav.Nm
782b547523eSJilles Tjoelkerto terminate immediately.
783208691fcSRuslan Ermilov.It Ic -regex Ar pattern
784208691fcSRuslan ErmilovTrue if the whole path of the file matches
785208691fcSRuslan Ermilov.Ar pattern
786208691fcSRuslan Ermilovusing regular expression.
787208691fcSRuslan ErmilovTo match a file named
788208691fcSRuslan Ermilov.Dq Pa ./foo/xyzzy ,
789208691fcSRuslan Ermilovyou can use the regular expression
790208691fcSRuslan Ermilov.Dq Li ".*/[xyz]*"
791208691fcSRuslan Ermilovor
792208691fcSRuslan Ermilov.Dq Li ".*/foo/.*" ,
793208691fcSRuslan Ermilovbut not
794208691fcSRuslan Ermilov.Dq Li xyzzy
795208691fcSRuslan Ermilovor
796208691fcSRuslan Ermilov.Dq Li /foo/ .
79746b993ffSWarner Losh.It Ic -samefile Ar name
79846b993ffSWarner LoshTrue if the file is a hard link to
79946b993ffSWarner Losh.Ar name .
80046b993ffSWarner LoshIf the command option
80146b993ffSWarner Losh.Ic -L
80246b993ffSWarner Loshis specified, it is also true if the file is a symbolic link and
80346b993ffSWarner Loshpoints to
80446b993ffSWarner Losh.Ar name .
8055a890aacSKirill Ponomarev.It Ic -size Ar n Ns Op Cm ckMGTP
80654874bb6SRuslan ErmilovTrue if the file's size, rounded up, in 512-byte blocks is
8079b50d902SRodney W. Grimes.Ar n .
8089b50d902SRodney W. GrimesIf
8099b50d902SRodney W. Grimes.Ar n
810bfd12208SRuslan Ermilovis followed by a
811bfd12208SRuslan Ermilov.Cm c ,
812bfd12208SRuslan Ermilovthen the primary is true if the
8139b50d902SRodney W. Grimesfile's size is
8149b50d902SRodney W. Grimes.Ar n
815bfd12208SRuslan Ermilovbytes (characters).
8165a890aacSKirill PonomarevSimilarly if
8175a890aacSKirill Ponomarev.Ar n
8185a890aacSKirill Ponomarevis followed by a scale indicator then the file's size is compared to
8195a890aacSKirill Ponomarev.Ar n
8205a890aacSKirill Ponomarevscaled as:
8215a890aacSKirill Ponomarev.Pp
8225a890aacSKirill Ponomarev.Bl -tag -width indent -compact
8235a890aacSKirill Ponomarev.It Cm k
8245a890aacSKirill Ponomarevkilobytes (1024 bytes)
8255a890aacSKirill Ponomarev.It Cm M
8265a890aacSKirill Ponomarevmegabytes (1024 kilobytes)
8275a890aacSKirill Ponomarev.It Cm G
8285a890aacSKirill Ponomarevgigabytes (1024 megabytes)
8295a890aacSKirill Ponomarev.It Cm T
8305a890aacSKirill Ponomarevterabytes (1024 gigabytes)
8315a890aacSKirill Ponomarev.It Cm P
8325a890aacSKirill Ponomarevpetabytes (1024 terabytes)
8335a890aacSKirill Ponomarev.El
8349ed0c92cSDavid Malone.It Ic -sparse
8359ed0c92cSDavid MaloneTrue if the current file is sparse,
8369ed0c92cSDavid Malonei.e. has fewer blocks allocated than expected based on its size in bytes.
8379ed0c92cSDavid MaloneThis might also match files that have been compressed by the filesystem.
8389b50d902SRodney W. Grimes.It Ic -type Ar t
8399b50d902SRodney W. GrimesTrue if the file is of the specified type.
8409b50d902SRodney W. GrimesPossible file types are as follows:
8419b50d902SRodney W. Grimes.Pp
842bfd12208SRuslan Ermilov.Bl -tag -width indent -compact
8439b50d902SRodney W. Grimes.It Cm b
8449b50d902SRodney W. Grimesblock special
8459b50d902SRodney W. Grimes.It Cm c
8469b50d902SRodney W. Grimescharacter special
8479b50d902SRodney W. Grimes.It Cm d
8489b50d902SRodney W. Grimesdirectory
8499b50d902SRodney W. Grimes.It Cm f
8509b50d902SRodney W. Grimesregular file
8519b50d902SRodney W. Grimes.It Cm l
8529b50d902SRodney W. Grimessymbolic link
8539b50d902SRodney W. Grimes.It Cm p
8549b50d902SRodney W. GrimesFIFO
8559b50d902SRodney W. Grimes.It Cm s
8569b50d902SRodney W. Grimessocket
8579b50d902SRodney W. Grimes.El
85846b993ffSWarner Losh.It Ic -uid Ar uname
85946b993ffSWarner LoshThe same thing as
86046b993ffSWarner Losh.Ar -user Ar uname
86146b993ffSWarner Loshfor compatibility with GNU find.
86246b993ffSWarner LoshGNU find imposes a restriction that
86346b993ffSWarner Losh.Ar uname
86446b993ffSWarner Loshis numeric, while
86581b295a1SEitan Adler.Nm
86646b993ffSWarner Loshdoes not.
8679b50d902SRodney W. Grimes.It Ic -user Ar uname
8689b50d902SRodney W. GrimesTrue if the file belongs to the user
8699b50d902SRodney W. Grimes.Ar uname .
8709b50d902SRodney W. GrimesIf
8719b50d902SRodney W. Grimes.Ar uname
8729b50d902SRodney W. Grimesis numeric and there is no such user name, then
8739b50d902SRodney W. Grimes.Ar uname
874bfd12208SRuslan Ermilovis treated as a user ID.
87546b993ffSWarner Losh.It Ic -wholename Ar pattern
87646b993ffSWarner LoshThe same thing as
87746b993ffSWarner Losh.Ic -path ,
87846b993ffSWarner Loshfor GNU find compatibility.
8799b50d902SRodney W. Grimes.El
8809b50d902SRodney W. Grimes.Sh OPERATORS
8819b50d902SRodney W. GrimesThe primaries may be combined using the following operators.
8829b50d902SRodney W. GrimesThe operators are listed in order of decreasing precedence.
883bfd12208SRuslan Ermilov.Pp
884fbccd9dbSRuslan Ermilov.Bl -tag -width indent -compact
8850c101fb2SJoseph Koshy.It Cm \&( Ar expression Cm \&)
8869b50d902SRodney W. GrimesThis evaluates to true if the parenthesized expression evaluates to
8879b50d902SRodney W. Grimestrue.
8889b50d902SRodney W. Grimes.Pp
8890c101fb2SJoseph Koshy.It Cm \&! Ar expression
8904a0193d3SJuli Mallett.It Cm -not Ar expression
8919b50d902SRodney W. GrimesThis is the unary
8929b50d902SRodney W. Grimes.Tn NOT
8939b50d902SRodney W. Grimesoperator.
8949b50d902SRodney W. GrimesIt evaluates to true if the expression is false.
8959b50d902SRodney W. Grimes.Pp
89646b993ffSWarner Losh.It Cm -false
89746b993ffSWarner LoshAlways false.
89846b993ffSWarner Losh.It Cm -true
89946b993ffSWarner LoshAlways true.
90046b993ffSWarner Losh.Pp
9019b50d902SRodney W. Grimes.It Ar expression Cm -and Ar expression
9029b50d902SRodney W. Grimes.It Ar expression expression
9039b50d902SRodney W. GrimesThe
9049b50d902SRodney W. Grimes.Cm -and
9059b50d902SRodney W. Grimesoperator is the logical
9069b50d902SRodney W. Grimes.Tn AND
9079b50d902SRodney W. Grimesoperator.
9089b50d902SRodney W. GrimesAs it is implied by the juxtaposition of two expressions it does not
9099b50d902SRodney W. Grimeshave to be specified.
9109b50d902SRodney W. GrimesThe expression evaluates to true if both expressions are true.
9119b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is false.
9129b50d902SRodney W. Grimes.Pp
9139b50d902SRodney W. Grimes.It Ar expression Cm -or Ar expression
9149b50d902SRodney W. GrimesThe
9159b50d902SRodney W. Grimes.Cm -or
9169b50d902SRodney W. Grimesoperator is the logical
9179b50d902SRodney W. Grimes.Tn OR
9189b50d902SRodney W. Grimesoperator.
9199b50d902SRodney W. GrimesThe expression evaluates to true if either the first or the second expression
9209b50d902SRodney W. Grimesis true.
9219b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is true.
9229b50d902SRodney W. Grimes.El
9239b50d902SRodney W. Grimes.Pp
9249b50d902SRodney W. GrimesAll operands and primaries must be separate arguments to
9258fe908efSRuslan Ermilov.Nm .
9269b50d902SRodney W. GrimesPrimaries which themselves take arguments expect each argument
9279b50d902SRodney W. Grimesto be a separate argument to
9288fe908efSRuslan Ermilov.Nm .
929ef6c7764STim J. Robbins.Sh ENVIRONMENT
930ef6c7764STim J. RobbinsThe
931ef6c7764STim J. Robbins.Ev LANG , LC_ALL , LC_COLLATE , LC_CTYPE , LC_MESSAGES
932ef6c7764STim J. Robbinsand
933ef6c7764STim J. Robbins.Ev LC_TIME
934ef6c7764STim J. Robbinsenvironment variables affect the execution of the
935ef6c7764STim J. Robbins.Nm
936ef6c7764STim J. Robbinsutility as described in
937ef6c7764STim J. Robbins.Xr environ 7 .
9389b50d902SRodney W. Grimes.Sh EXAMPLES
9399b50d902SRodney W. GrimesThe following examples are shown as given to the shell:
940bfd12208SRuslan Ermilov.Bl -tag -width indent
9419b50d902SRodney W. Grimes.It Li "find / \e! -name \*q*.c\*q -print"
942bfd12208SRuslan ErmilovPrint out a list of all the files whose names do not end in
943bfd12208SRuslan Ermilov.Pa .c .
9449b50d902SRodney W. Grimes.It Li "find / -newer ttt -user wnj -print"
945bfd12208SRuslan ErmilovPrint out a list of all the files owned by user
946bfd12208SRuslan Ermilov.Dq wnj
947bfd12208SRuslan Ermilovthat are newer
948bfd12208SRuslan Ermilovthan the file
949bfd12208SRuslan Ermilov.Pa ttt .
9509b50d902SRodney W. Grimes.It Li "find / \e! \e( -newer ttt -user wnj \e) -print"
951bfd12208SRuslan ErmilovPrint out a list of all the files which are not both newer than
952bfd12208SRuslan Ermilov.Pa ttt
953bfd12208SRuslan Ermilovand owned by
954bfd12208SRuslan Ermilov.Dq wnj .
9559b50d902SRodney W. Grimes.It Li "find / \e( -newer ttt -or -user wnj \e) -print"
956bfd12208SRuslan ErmilovPrint out a list of all the files that are either owned by
957bfd12208SRuslan Ermilov.Dq wnj
958bfd12208SRuslan Ermilovor that are newer than
959bfd12208SRuslan Ermilov.Pa ttt .
960e578c242STom Rhodes.It Li "find / -newerct '1 minute ago' -print"
961ea92232aSPoul-Henning KampPrint out a list of all the files whose inode change time is more
962ea92232aSPoul-Henning Kamprecent than the current time minus one minute.
96354874bb6SRuslan Ermilov.It Li "find / -type f -exec echo {} \e;"
964e578c242STom RhodesUse the
965e578c242STom Rhodes.Xr echo 1
966e578c242STom Rhodescommand to print out a list of all the files.
967a05cb852SJilles Tjoelker.It Li "find -L /usr/ports/packages -type l -exec rm -- {} +"
9681c832963SOliver EikemeierDelete all broken symbolic links in
9691c832963SOliver Eikemeier.Pa /usr/ports/packages .
9701c832963SOliver Eikemeier.It Li "find /usr/src -name CVS -prune -o -depth +6 -print"
9711c832963SOliver EikemeierFind files and directories that are at least seven levels deep
9721c832963SOliver Eikemeierin the working directory
9731c832963SOliver Eikemeier.Pa /usr/src .
9741c832963SOliver Eikemeier.It Li "find /usr/src -name CVS -prune -o -mindepth 7 -print"
9751c832963SOliver EikemeierIs not equivalent to the previous example, since
9761c832963SOliver Eikemeier.Ic -prune
9771c832963SOliver Eikemeieris not evaluated below level seven.
9789b50d902SRodney W. Grimes.El
979e578c242STom Rhodes.Sh COMPATIBILITY
980e578c242STom RhodesThe
981e578c242STom Rhodes.Ic -follow
98247d91ba3SDag-Erling Smørgravprimary is deprecated; the
98347d91ba3SDag-Erling Smørgrav.Fl L
98447d91ba3SDag-Erling Smørgravoption should be used instead.
98547d91ba3SDag-Erling SmørgravSee the
98647d91ba3SDag-Erling Smørgrav.Sx STANDARDS
98747d91ba3SDag-Erling Smørgravsection below for details.
9889b50d902SRodney W. Grimes.Sh SEE ALSO
989567664c4SOllivier Robert.Xr chflags 1 ,
9909b50d902SRodney W. Grimes.Xr chmod 1 ,
991ea92232aSPoul-Henning Kamp.Xr cvs 1 ,
9929b50d902SRodney W. Grimes.Xr locate 1 ,
993d740b7c7SPawel Jakub Dawidek.Xr lsvfs 1 ,
99441cbb624SJoseph Koshy.Xr whereis 1 ,
99541cbb624SJoseph Koshy.Xr which 1 ,
996a8d50686STom Rhodes.Xr xargs 1 ,
9979b50d902SRodney W. Grimes.Xr stat 2 ,
99853e87059STom Rhodes.Xr acl 3 ,
9999b50d902SRodney W. Grimes.Xr fts 3 ,
10009b50d902SRodney W. Grimes.Xr getgrent 3 ,
10019b50d902SRodney W. Grimes.Xr getpwent 3 ,
10029b50d902SRodney W. Grimes.Xr strmode 3 ,
100394ad6032SRuslan Ermilov.Xr re_format 7 ,
10049b50d902SRodney W. Grimes.Xr symlink 7
10059b50d902SRodney W. Grimes.Sh STANDARDS
10069b50d902SRodney W. GrimesThe
10078fe908efSRuslan Ermilov.Nm
10089b50d902SRodney W. Grimesutility syntax is a superset of the syntax specified by the
10091c832963SOliver Eikemeier.St -p1003.1-2001
10109b50d902SRodney W. Grimesstandard.
10119b50d902SRodney W. Grimes.Pp
10121c832963SOliver EikemeierAll the single character options except
1013fbccd9dbSRuslan Ermilov.Fl H
10141c832963SOliver Eikemeierand
1015fbccd9dbSRuslan Ermilov.Fl L
1016659a728eSCeri Daviesas well as
1017659a728eSCeri Davies.Ic -amin , -anewer , -cmin , -cnewer , -delete , -empty , -fstype ,
1018659a728eSCeri Davies.Ic -iname , -inum , -iregex , -ls , -maxdepth , -mindepth , -mmin ,
1019*75e6f664SDaniel Ebdrup Jensen.Ic -not , -path , -print0 , -regex , -sparse
1020440a24d8SCeri Daviesand all of the
1021*75e6f664SDaniel Ebdrup Jensen.Fl B*
1022440a24d8SCeri Daviesbirthtime related primaries are extensions to
10231c832963SOliver Eikemeier.St -p1003.1-2001 .
1024f6e4fb22SSteve Price.Pp
10259b50d902SRodney W. GrimesHistorically, the
102647d91ba3SDag-Erling Smørgrav.Fl d , L
10279b50d902SRodney W. Grimesand
10289b50d902SRodney W. Grimes.Fl x
1029bfd12208SRuslan Ermilovoptions were implemented using the primaries
1030bfd12208SRuslan Ermilov.Ic -depth , -follow ,
1031bfd12208SRuslan Ermilovand
1032bfd12208SRuslan Ermilov.Ic -xdev .
10339b50d902SRodney W. GrimesThese primaries always evaluated to true.
10349b50d902SRodney W. GrimesAs they were really global variables that took effect before the traversal
10359b50d902SRodney W. Grimesbegan, some legal expressions could have unexpected results.
1036bfd12208SRuslan ErmilovAn example is the expression
1037bfd12208SRuslan Ermilov.Ic -print Cm -o Ic -depth .
1038bfd12208SRuslan ErmilovAs
1039bfd12208SRuslan Ermilov.Ic -print
1040bfd12208SRuslan Ermilovalways evaluates to true, the standard order of evaluation
1041bfd12208SRuslan Ermilovimplies that
1042bfd12208SRuslan Ermilov.Ic -depth
1043bfd12208SRuslan Ermilovwould never be evaluated.
10449b50d902SRodney W. GrimesThis is not the case.
10459b50d902SRodney W. Grimes.Pp
1046bfd12208SRuslan ErmilovThe operator
1047bfd12208SRuslan Ermilov.Cm -or
1048bfd12208SRuslan Ermilovwas implemented as
1049bfd12208SRuslan Ermilov.Cm -o ,
1050bfd12208SRuslan Ermilovand the operator
1051bfd12208SRuslan Ermilov.Cm -and
1052bfd12208SRuslan Ermilovwas implemented as
1053bfd12208SRuslan Ermilov.Cm -a .
10549b50d902SRodney W. Grimes.Pp
10559b50d902SRodney W. GrimesHistoric implementations of the
1056bfd12208SRuslan Ermilov.Ic -exec
10579b50d902SRodney W. Grimesand
1058bfd12208SRuslan Ermilov.Ic -ok
1059bfd12208SRuslan Ermilovprimaries did not replace the string
1060bfd12208SRuslan Ermilov.Dq Li {}
1061bfd12208SRuslan Ermilovin the utility name or the
10629b50d902SRodney W. Grimesutility arguments if it had preceding or following non-whitespace characters.
10639b50d902SRodney W. GrimesThis version replaces it no matter where in the utility name or arguments
10649b50d902SRodney W. Grimesit appears.
10657c1d4b3aSAkinori MUSHA.Pp
10667c1d4b3aSAkinori MUSHAThe
10677c1d4b3aSAkinori MUSHA.Fl E
106847d91ba3SDag-Erling Smørgravoption was inspired by the equivalent
10697c1d4b3aSAkinori MUSHA.Xr grep 1
10707c1d4b3aSAkinori MUSHAand
107147d91ba3SDag-Erling Smørgrav.Xr sed 1
107247d91ba3SDag-Erling Smørgravoptions.
1073ad487600SColin Percival.Sh HISTORY
1074ad487600SColin PercivalA
1075ad487600SColin Percival.Nm
1076ad487600SColin Percivalcommand appeared in
1077ad487600SColin Percival.At v1 .
10789b50d902SRodney W. Grimes.Sh BUGS
10799b50d902SRodney W. GrimesThe special characters used by
10808fe908efSRuslan Ermilov.Nm
10819b50d902SRodney W. Grimesare also special characters to many shell programs.
1082bfd12208SRuslan ErmilovIn particular, the characters
1083bfd12208SRuslan Ermilov.Dq Li * ,
1084bfd12208SRuslan Ermilov.Dq Li \&[ ,
1085bfd12208SRuslan Ermilov.Dq Li \&] ,
1086bfd12208SRuslan Ermilov.Dq Li \&? ,
1087bfd12208SRuslan Ermilov.Dq Li \&( ,
1088bfd12208SRuslan Ermilov.Dq Li \&) ,
1089bfd12208SRuslan Ermilov.Dq Li \&! ,
1090bfd12208SRuslan Ermilov.Dq Li \e
1091bfd12208SRuslan Ermilovand
1092bfd12208SRuslan Ermilov.Dq Li \&;
1093bfd12208SRuslan Ermilovmay have to be escaped from the shell.
10949b50d902SRodney W. Grimes.Pp
10959b50d902SRodney W. GrimesAs there is no delimiter separating options and file names or file
10969b50d902SRodney W. Grimesnames and the
10979b50d902SRodney W. Grimes.Ar expression ,
1098bfd12208SRuslan Ermilovit is difficult to specify files named
1099bfd12208SRuslan Ermilov.Pa -xdev
1100bfd12208SRuslan Ermilovor
1101bfd12208SRuslan Ermilov.Pa \&! .
11029b50d902SRodney W. GrimesThese problems are handled by the
11039b50d902SRodney W. Grimes.Fl f
11049b50d902SRodney W. Grimesoption and the
11059b50d902SRodney W. Grimes.Xr getopt 3
1106bfd12208SRuslan Ermilov.Dq Fl Fl
1107bfd12208SRuslan Ermilovconstruct.
1108abacbbbfSPeter Wemm.Pp
1109abacbbbfSPeter WemmThe
1110abacbbbfSPeter Wemm.Ic -delete
111156f7a840SBill Fumerolaprimary does not interact well with other options that cause the file system
1112abacbbbfSPeter Wemmtree traversal options to be changed.
1113ad487600SColin Percival.Pp
11144f45d811STim J. RobbinsThe
1115dfef91e9SColin Percival.Ic -mindepth
1116dfef91e9SColin Percivaland
1117dfef91e9SColin Percival.Ic -maxdepth
11182cb640f6SColin Percivalprimaries are actually global options (as documented above).
11192cb640f6SColin PercivalThey should
1120dfef91e9SColin Percivalprobably be replaced by options which look like options.
1121