xref: /freebsd/usr.bin/find/find.1 (revision d0353b836e88609b9400851d32e0aa6645ff9be3)
19b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
29b50d902SRodney W. Grimes.\"
39b50d902SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
49b50d902SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc.
59b50d902SRodney W. Grimes.\"
69b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
79b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
89b50d902SRodney W. Grimes.\" are met:
99b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
109b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
119b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
129b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
139b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
149b50d902SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
159b50d902SRodney W. Grimes.\"    must display the following acknowledgement:
169b50d902SRodney W. Grimes.\"	This product includes software developed by the University of
179b50d902SRodney W. Grimes.\"	California, Berkeley and its contributors.
189b50d902SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
199b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
209b50d902SRodney W. Grimes.\"    without specific prior written permission.
219b50d902SRodney W. Grimes.\"
229b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
239b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
249b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
259b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
269b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
279b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
289b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
299b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
309b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
319b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
329b50d902SRodney W. Grimes.\" SUCH DAMAGE.
339b50d902SRodney W. Grimes.\"
34841484cdSPeter Wemm.\"	@(#)find.1	8.7 (Berkeley) 5/9/95
35c3aac50fSPeter Wemm.\" $FreeBSD$
369b50d902SRodney W. Grimes.\"
37841484cdSPeter Wemm.Dd May 9, 1995
389b50d902SRodney W. Grimes.Dt FIND 1
399b50d902SRodney W. Grimes.Os
409b50d902SRodney W. Grimes.Sh NAME
419b50d902SRodney W. Grimes.Nm find
429b50d902SRodney W. Grimes.Nd walk a file hierarchy
439b50d902SRodney W. Grimes.Sh SYNOPSIS
448fe908efSRuslan Ermilov.Nm
459b50d902SRodney W. Grimes.Op Fl H | Fl L | Fl P
466d0c7e13SWolfram Schneider.Op Fl Xdsx
470c101fb2SJoseph Koshy.Op Fl f Ar pathname
489b88faecSRuslan Ermilov.Op Ar pathname ...\&
499b50d902SRodney W. Grimes.Ar expression
509b50d902SRodney W. Grimes.Sh DESCRIPTION
519b50d902SRodney W. Grimes.Nm Find
529b50d902SRodney W. Grimesrecursively descends the directory tree for each
530c101fb2SJoseph Koshy.Ar pathname
549b50d902SRodney W. Grimeslisted, evaluating an
559b50d902SRodney W. Grimes.Ar expression
569b50d902SRodney W. Grimes(composed of the ``primaries'' and ``operands'' listed below) in terms
579b50d902SRodney W. Grimesof each file in the tree.
589b50d902SRodney W. Grimes.Pp
599b50d902SRodney W. GrimesThe options are as follows:
609b50d902SRodney W. Grimes.Pp
619b50d902SRodney W. Grimes.Bl -tag -width Ds
629b50d902SRodney W. Grimes.It Fl H
639b50d902SRodney W. GrimesThe
649b50d902SRodney W. Grimes.Fl H
659b50d902SRodney W. Grimesoption causes the file information and file type (see
669b50d902SRodney W. Grimes.Xr stat 2 )
679b50d902SRodney W. Grimesreturned for each symbolic link specified on the command line to be
689b50d902SRodney W. Grimesthose of the file referenced by the link, not the link itself.
699b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will
706df69548SBruce Evansbe for the link itself.
716df69548SBruce EvansFile information of all symbolic links not on
729b50d902SRodney W. Grimesthe command line is that of the link itself.
739b50d902SRodney W. Grimes.It Fl L
749b50d902SRodney W. GrimesThe
759b50d902SRodney W. Grimes.Fl L
769b50d902SRodney W. Grimesoption causes the file information and file type (see
779b50d902SRodney W. Grimes.Xr stat 2 )
789b50d902SRodney W. Grimesreturned for each symbolic link to be those of the file referenced by the
799b50d902SRodney W. Grimeslink, not the link itself.
809b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will
819b50d902SRodney W. Grimesbe for the link itself.
829b50d902SRodney W. Grimes.It Fl P
839b50d902SRodney W. GrimesThe
849b50d902SRodney W. Grimes.Fl P
859b50d902SRodney W. Grimesoption causes the file information and file type (see
869b50d902SRodney W. Grimes.Xr stat 2 )
879b50d902SRodney W. Grimesreturned for each symbolic link to be those of the link itself.
883d9a9402SJohn PolstraThis is the default.
899b50d902SRodney W. Grimes.It Fl X
909b50d902SRodney W. GrimesThe
919b50d902SRodney W. Grimes.Fl X
929b50d902SRodney W. Grimesoption is a modification to permit
939b50d902SRodney W. Grimes.Nm
949b50d902SRodney W. Grimesto be safely used in conjunction with
959b50d902SRodney W. Grimes.Xr xargs 1 .
969b50d902SRodney W. GrimesIf a file name contains any of the delimiting characters used by
979b50d902SRodney W. Grimes.Xr xargs ,
989b50d902SRodney W. Grimesa diagnostic message is displayed on standard error, and the file
999b50d902SRodney W. Grimesis skipped.
1009b50d902SRodney W. GrimesThe delimiting characters include single (`` ' '') and double (`` " '')
1019b50d902SRodney W. Grimesquotes, backslash (``\e''), space, tab and newline characters.
1029b50d902SRodney W. Grimes.It Fl d
1039b50d902SRodney W. GrimesThe
1049b50d902SRodney W. Grimes.Fl d
1059b50d902SRodney W. Grimesoption causes
1068fe908efSRuslan Ermilov.Nm
1079b50d902SRodney W. Grimesto perform a depth\-first traversal, i.e. directories
1089b50d902SRodney W. Grimesare visited in post\-order and all entries in a directory will be acted
1099b50d902SRodney W. Grimeson before the directory itself.
1109b50d902SRodney W. GrimesBy default,
1118fe908efSRuslan Ermilov.Nm
1129b50d902SRodney W. Grimesvisits directories in pre\-order, i.e. before their contents.
1139b50d902SRodney W. GrimesNote, the default is
1149b50d902SRodney W. Grimes.Ar not
1159b50d902SRodney W. Grimesa breadth\-first traversal.
1169b50d902SRodney W. Grimes.It Fl f
1179b50d902SRodney W. GrimesThe
1189b50d902SRodney W. Grimes.Fl f
1199b50d902SRodney W. Grimesoption specifies a file hierarchy for
1208fe908efSRuslan Ermilov.Nm
1219b50d902SRodney W. Grimesto traverse.
1229b50d902SRodney W. GrimesFile hierarchies may also be specified as the operands immediately
1239b50d902SRodney W. Grimesfollowing the options.
1246d0c7e13SWolfram Schneider.It Fl s
1256d0c7e13SWolfram SchneiderThe
1266d0c7e13SWolfram Schneider.Fl s
1276df69548SBruce Evansoption causes
1288fe908efSRuslan Ermilov.Nm
1296df69548SBruce Evansto traverse the file hierarchies in lexicographical order,
1306df69548SBruce Evansi.e., alphabetical order within each directory.
1316df69548SBruce EvansNote:
1326d0c7e13SWolfram Schneider.Sq find -s
1336d0c7e13SWolfram Schneiderand
1346d0c7e13SWolfram Schneider.So
1356d0c7e13SWolfram Schneiderfind | sort
1366d0c7e13SWolfram Schneider.Sc
1376d0c7e13SWolfram Schneidermay give different results.
1389b50d902SRodney W. Grimes.It Fl x
1399b50d902SRodney W. GrimesThe
1409b50d902SRodney W. Grimes.Fl x
1419b50d902SRodney W. Grimesoption prevents
1428fe908efSRuslan Ermilov.Nm
1439b50d902SRodney W. Grimesfrom descending into directories that have a device number different
1449b50d902SRodney W. Grimesthan that of the file from which the descent began.
1459b50d902SRodney W. Grimes.El
1469b50d902SRodney W. Grimes.Sh PRIMARIES
1479b50d902SRodney W. Grimes.Bl -tag -width Ds
1483f5223f8SWolfram Schneider.It Ic -amin Ar n
1493f5223f8SWolfram SchneiderTrue if the difference between the file last access time and the time
1508fe908efSRuslan Ermilov.Nm
15145fe9882SMatthew Huntwas started, rounded up to the next full minute, is
1523f5223f8SWolfram Schneider.Ar n
15345fe9882SMatthew Huntminutes.
1549b50d902SRodney W. Grimes.It Ic -atime Ar n
1559b50d902SRodney W. GrimesTrue if the difference between the file last access time and the time
1568fe908efSRuslan Ermilov.Nm
1579b50d902SRodney W. Grimeswas started, rounded up to the next full 24\-hour period, is
1589b50d902SRodney W. Grimes.Ar n
1599b50d902SRodney W. Grimes24\-hour periods.
1603f5223f8SWolfram Schneider.It Ic -cmin Ar n
1613f5223f8SWolfram SchneiderTrue if the difference between the time of last change of file status
1623f5223f8SWolfram Schneiderinformation and the time
1638fe908efSRuslan Ermilov.Nm
16445fe9882SMatthew Huntwas started, rounded up to the next full minute, is
1653f5223f8SWolfram Schneider.Ar n
16645fe9882SMatthew Huntminutes.
1679b50d902SRodney W. Grimes.It Ic -ctime Ar n
1689b50d902SRodney W. GrimesTrue if the difference between the time of last change of file status
1699b50d902SRodney W. Grimesinformation and the time
1708fe908efSRuslan Ermilov.Nm
1719b50d902SRodney W. Grimeswas started, rounded up to the next full 24\-hour period, is
1729b50d902SRodney W. Grimes.Ar n
1739b50d902SRodney W. Grimes24\-hour periods.
174abacbbbfSPeter Wemm.It Ic -delete
1756df69548SBruce EvansDelete found files and/or directories.
1766df69548SBruce EvansAlways returns true.
1776df69548SBruce EvansThis executes
178abacbbbfSPeter Wemmfrom the current working directory as
179abacbbbfSPeter Wemm.Nm
1806df69548SBruce Evansrecurses down the tree.
1816df69548SBruce EvansIt will not attempt to delete a filename with a ``/''
1826ad98044SEivind Eklundcharacter in its pathname relative to "." for security reasons.
183abacbbbfSPeter WemmDepth\-first traversal processing is implied by this option.
184ed1a4621SPeter Wemm.It Ic -empty
185ed1a4621SPeter WemmTrue if the current file or directory is empty.
1869b50d902SRodney W. Grimes.It Ic -exec Ar utility Op argument ... ;
1879b50d902SRodney W. GrimesTrue if the program named
1889b50d902SRodney W. Grimes.Ar utility
1899b50d902SRodney W. Grimesreturns a zero value as its exit status.
1909b50d902SRodney W. GrimesOptional arguments may be passed to the utility.
1919b50d902SRodney W. GrimesThe expression must be terminated by a semicolon (``;'').
1929b50d902SRodney W. GrimesIf the string ``{}'' appears anywhere in the utility name or the
1939b50d902SRodney W. Grimesarguments it is replaced by the pathname of the current file.
1949b50d902SRodney W. Grimes.Ar Utility
1959b50d902SRodney W. Grimeswill be executed from the directory from which
1968fe908efSRuslan Ermilov.Nm
1979b50d902SRodney W. Grimeswas executed.
198127d7563SWarner Losh.It Ic -execdir Ar utility Op argument ... ;
199127d7563SWarner LoshThe
200127d7563SWarner Losh.Ic \&-execdir
201127d7563SWarner Loshprimary is identical to the
202127d7563SWarner Losh.Ic -exec
203127d7563SWarner Loshprimary with the exception that
204127d7563SWarner Losh.Ar Utility
205127d7563SWarner Loshwill be executed from the directory that holds
2066df69548SBruce Evansthe current file.
2076df69548SBruce EvansThe filename substituted for
208127d7563SWarner Loshthe string ``{}'' is not qualified.
2099b50d902SRodney W. Grimes.It Ic -fstype Ar type
2109b50d902SRodney W. GrimesTrue if the file is contained in a file system of type
2119b50d902SRodney W. Grimes.Ar type .
212841484cdSPeter WemmThe
213841484cdSPeter Wemm.Xr sysctl 8
214841484cdSPeter Wemmcommand can be used to find out the types of filesystems
215841484cdSPeter Wemmthat are available on the system:
216841484cdSPeter Wemm.Bd -literal -offset indent
217841484cdSPeter Wemmsysctl vfs
218841484cdSPeter Wemm.Ed
219841484cdSPeter WemmIn addition, there are two pseudo-types, ``local'' and ``rdonly''.
2209b50d902SRodney W. GrimesThe former matches any file system physically mounted on the system where
2219b50d902SRodney W. Grimesthe
2228fe908efSRuslan Ermilov.Nm
2239b50d902SRodney W. Grimesis being executed and the latter matches any file system which is
2249b50d902SRodney W. Grimesmounted read-only.
2259b50d902SRodney W. Grimes.It Ic -group Ar gname
2269b50d902SRodney W. GrimesTrue if the file belongs to the group
2279b50d902SRodney W. Grimes.Ar gname  .
2289b50d902SRodney W. GrimesIf
2299b50d902SRodney W. Grimes.Ar gname
2309b50d902SRodney W. Grimesis numeric and there is no such group name, then
2319b50d902SRodney W. Grimes.Ar gname
2329b50d902SRodney W. Grimesis treated as a group id.
2339b50d902SRodney W. Grimes.It Ic -inum Ar n
2349b50d902SRodney W. GrimesTrue if the file has inode number
2359b50d902SRodney W. Grimes.Ar n  .
2369b50d902SRodney W. Grimes.It Ic -links Ar n
2379b50d902SRodney W. GrimesTrue if the file has
2389b50d902SRodney W. Grimes.Ar n
2399b50d902SRodney W. Grimeslinks.
2409b50d902SRodney W. Grimes.It Ic -ls
2419b50d902SRodney W. GrimesThis primary always evaluates to true.
2429b50d902SRodney W. GrimesThe following information for the current file is written to standard output:
2439b50d902SRodney W. Grimesits inode number, size in 512\-byte blocks, file permissions, number of hard
2449b50d902SRodney W. Grimeslinks, owner, group, size in bytes, last modification time, and pathname.
2459b50d902SRodney W. GrimesIf the file is a block or character special file, the major and minor numbers
2469b50d902SRodney W. Grimeswill be displayed instead of the size in bytes.
2479b50d902SRodney W. GrimesIf the file is a symbolic link, the pathname of the linked\-to file will be
2489b50d902SRodney W. Grimesdisplayed preceded by ``\->''.
2499b50d902SRodney W. GrimesThe format is identical to that produced by ``ls \-dgils''.
250c76bc8f3SOllivier Robert.It Ic -maxdepth Ar n
251c76bc8f3SOllivier RobertTrue if the depth of the current file into the tree is less than or equal to
252c76bc8f3SOllivier Robert.Ar n .
253c76bc8f3SOllivier Robert.It Ic -mindepth Ar n
254c76bc8f3SOllivier RobertTrue if the depth of the current file into the tree is greater than or equal to
255c76bc8f3SOllivier Robert.Ar n .
2563f5223f8SWolfram Schneider.It Ic -mmin Ar n
2573f5223f8SWolfram SchneiderTrue if the difference between the file last modification time and the time
2588fe908efSRuslan Ermilov.Nm
25945fe9882SMatthew Huntwas started, rounded up to the next full minute, is
2603f5223f8SWolfram Schneider.Ar n
26145fe9882SMatthew Huntminutes.
2629b50d902SRodney W. Grimes.It Ic -mtime Ar n
2639b50d902SRodney W. GrimesTrue if the difference between the file last modification time and the time
2648fe908efSRuslan Ermilov.Nm
2659b50d902SRodney W. Grimeswas started, rounded up to the next full 24\-hour period, is
2669b50d902SRodney W. Grimes.Ar n
2679b50d902SRodney W. Grimes24\-hour periods.
268841484cdSPeter Wemm.It Ic \&-ok Ar utility Op argument ... ;
2699b50d902SRodney W. GrimesThe
2709b50d902SRodney W. Grimes.Ic \&-ok
2719b50d902SRodney W. Grimesprimary is identical to the
2729b50d902SRodney W. Grimes.Ic -exec
2739b50d902SRodney W. Grimesprimary with the exception that
2748fe908efSRuslan Ermilov.Nm
2759b50d902SRodney W. Grimesrequests user affirmation for the execution of the utility by printing
2769b50d902SRodney W. Grimesa message to the terminal and reading a response.
2779b50d902SRodney W. GrimesIf the response is other than ``y'' the command is not executed and the
2789b50d902SRodney W. Grimesvalue of the
2799b50d902SRodney W. Grimes.Ar \&ok
2809b50d902SRodney W. Grimesexpression is false.
2819b50d902SRodney W. Grimes.It Ic -name Ar pattern
2829b50d902SRodney W. GrimesTrue if the last component of the pathname being examined matches
2839b50d902SRodney W. Grimes.Ar pattern  .
2849b50d902SRodney W. GrimesSpecial shell pattern matching characters (``['', ``]'', ``*'', and ``?'')
2859b50d902SRodney W. Grimesmay be used as part of
2869b50d902SRodney W. Grimes.Ar pattern  .
2879b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a
2889b50d902SRodney W. Grimesbackslash (``\e'').
2899b50d902SRodney W. Grimes.It Ic -newer Ar file
2909b50d902SRodney W. GrimesTrue if the current file has a more recent last modification time than
2919b50d902SRodney W. Grimes.Ar file  .
2929b50d902SRodney W. Grimes.It Ic -nouser
2939b50d902SRodney W. GrimesTrue if the file belongs to an unknown user.
2949b50d902SRodney W. Grimes.It Ic -nogroup
2959b50d902SRodney W. GrimesTrue if the file belongs to an unknown group.
2969b50d902SRodney W. Grimes.It Ic -path Ar pattern
2979b50d902SRodney W. GrimesTrue if the pathname being examined matches
2989b50d902SRodney W. Grimes.Ar pattern  .
2999b50d902SRodney W. GrimesSpecial shell pattern matching characters (``['', ``]'', ``*'', and ``?'')
3009b50d902SRodney W. Grimesmay be used as part of
3019b50d902SRodney W. Grimes.Ar pattern  .
3029b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a
3039b50d902SRodney W. Grimesbackslash (``\e'').
3049b50d902SRodney W. GrimesSlashes (``/'') are treated as normal characters and do not have to be
3059b50d902SRodney W. Grimesmatched explicitly.
306b9569cadSKris Kennaway.It Xo
307b9569cadSKris Kennaway.Ic -perm
308d0353b83SRuslan Ermilov.Oo Fl Oc Ns Ar mode
309b9569cadSKris Kennaway.Xc
3109b50d902SRodney W. GrimesThe
3119b50d902SRodney W. Grimes.Ar mode
3129b50d902SRodney W. Grimesmay be either symbolic (see
3139b50d902SRodney W. Grimes.Xr chmod  1  )
3149b50d902SRodney W. Grimesor an octal number.
3159b50d902SRodney W. GrimesIf the mode is symbolic, a starting value of zero is assumed and the
3169b50d902SRodney W. Grimesmode sets or clears permissions without regard to the process' file mode
3179b50d902SRodney W. Grimescreation mask.
3189b50d902SRodney W. GrimesIf the mode is octal, only bits 07777
3199b50d902SRodney W. Grimes.Pf ( Dv S_ISUID
3209b50d902SRodney W. Grimes|
3219b50d902SRodney W. Grimes.Dv S_ISGID
3229b50d902SRodney W. Grimes|
3239b50d902SRodney W. Grimes.Dv S_ISTXT
3249b50d902SRodney W. Grimes|
3259b50d902SRodney W. Grimes.Dv S_IRWXU
3269b50d902SRodney W. Grimes|
3279b50d902SRodney W. Grimes.Dv S_IRWXG
3289b50d902SRodney W. Grimes|
3299b50d902SRodney W. Grimes.Dv S_IRWXO )
3309b50d902SRodney W. Grimesof the file's mode bits participate
3319b50d902SRodney W. Grimesin the comparison.
3329b88faecSRuslan ErmilovIf the mode is preceded by a dash
3339b88faecSRuslan Ermilov.Pq Dq - ,
3349b88faecSRuslan Ermilovthis primary evaluates to true
3359b50d902SRodney W. Grimesif at least all of the bits in the mode are set in the file's mode bits.
3369b88faecSRuslan ErmilovIf the mode is preceded by a plus
3379b88faecSRuslan Ermilov.Pq Dq + ,
3389b88faecSRuslan Ermilovthis primary evaluates to true
3399d2796c3SOllivier Robertif any of the bits in the mode are set in the file's mode bits.
3409d2796c3SOllivier RobertOtherwise, this primary evaluates to true if
3419b50d902SRodney W. Grimesthe bits in the mode exactly match the file's mode bits.
3429b50d902SRodney W. GrimesNote, the first character of a symbolic mode may not be a dash (``\-'').
343567664c4SOllivier Robert.It Ic -flags Op Fl Ns Ar flags
344567664c4SOllivier RobertThis primary evaluates to true if exactly those flags of the file are
345567664c4SOllivier Robertset which are also set using the specified
346567664c4SOllivier Robert.Ar flags
347567664c4SOllivier Robert(if these are not preceded by a dash (``\-''),
348567664c4SOllivier Robertor if they match the specified flags (if these are preceded by a dash).
349567664c4SOllivier RobertThe
350567664c4SOllivier Robert.Ar flags
351567664c4SOllivier Robertare specified using symbolic names (see
352567664c4SOllivier Robert.Xr chflags 1 ) .
353567664c4SOllivier RobertNote that this is different from
354567664c4SOllivier Robert.Ic -perm  ,
355567664c4SOllivier Robertwhich only allows you to specify flags which are set.
3569b50d902SRodney W. Grimes.It Ic -print
3579b50d902SRodney W. GrimesThis primary always evaluates to true.
3589b50d902SRodney W. GrimesIt prints the pathname of the current file to standard output.
359841484cdSPeter WemmIf none of
3609b50d902SRodney W. Grimes.Ic -exec ,
3617cd23434SGarrett Wollman.Ic -ls ,
3627cd23434SGarrett Wollman.Ic -print0 ,
3639b50d902SRodney W. Grimesor
3649b50d902SRodney W. Grimes.Ic \&-ok
365841484cdSPeter Wemmis specified, the given expression shall be effectively replaced by
366841484cdSPeter Wemm.Cm \&( Ns Ar given\& expression Ns Cm \&)
367841484cdSPeter Wemm.Ic -print .
3687cd23434SGarrett Wollman.It Ic -print0
3697cd23434SGarrett WollmanThis primary always evaluates to true.
370fbe0d04aSMasafumi Max NAKANEIt prints the pathname of the current file to standard output, followed by an
3717cd23434SGarrett Wollman.Tn ASCII
3727cd23434SGarrett Wollman.Tn NUL
3737cd23434SGarrett Wollmancharacter (character code 0).
3749b50d902SRodney W. Grimes.It Ic -prune
3759b50d902SRodney W. GrimesThis primary always evaluates to true.
3769b50d902SRodney W. GrimesIt causes
3778fe908efSRuslan Ermilov.Nm
3789b50d902SRodney W. Grimesto not descend into the current file.
3799b50d902SRodney W. GrimesNote, the
3809b50d902SRodney W. Grimes.Ic -prune
3819b50d902SRodney W. Grimesprimary has no effect if the
3829b50d902SRodney W. Grimes.Fl d
3839b50d902SRodney W. Grimesoption was specified.
3849b50d902SRodney W. Grimes.It Ic -size Ar n Ns Op Cm c
3859b50d902SRodney W. GrimesTrue if the file's size, rounded up, in 512\-byte blocks is
3869b50d902SRodney W. Grimes.Ar n  .
3879b50d902SRodney W. GrimesIf
3889b50d902SRodney W. Grimes.Ar n
3899b50d902SRodney W. Grimesis followed by a ``c'', then the primary is true if the
3909b50d902SRodney W. Grimesfile's size is
3919b50d902SRodney W. Grimes.Ar n
3929b50d902SRodney W. Grimesbytes.
3939b50d902SRodney W. Grimes.It Ic -type Ar t
3949b50d902SRodney W. GrimesTrue if the file is of the specified type.
3959b50d902SRodney W. GrimesPossible file types are as follows:
3969b50d902SRodney W. Grimes.Pp
3979b50d902SRodney W. Grimes.Bl -tag -width flag -offset indent -compact
3989b50d902SRodney W. Grimes.It Cm b
3999b50d902SRodney W. Grimesblock special
4009b50d902SRodney W. Grimes.It Cm c
4019b50d902SRodney W. Grimescharacter special
4029b50d902SRodney W. Grimes.It Cm d
4039b50d902SRodney W. Grimesdirectory
4049b50d902SRodney W. Grimes.It Cm f
4059b50d902SRodney W. Grimesregular file
4069b50d902SRodney W. Grimes.It Cm l
4079b50d902SRodney W. Grimessymbolic link
4089b50d902SRodney W. Grimes.It Cm p
4099b50d902SRodney W. GrimesFIFO
4109b50d902SRodney W. Grimes.It Cm s
4119b50d902SRodney W. Grimessocket
4129b50d902SRodney W. Grimes.El
4139b50d902SRodney W. Grimes.Pp
4149b50d902SRodney W. Grimes.It Ic -user Ar uname
4159b50d902SRodney W. GrimesTrue if the file belongs to the user
4169b50d902SRodney W. Grimes.Ar uname  .
4179b50d902SRodney W. GrimesIf
4189b50d902SRodney W. Grimes.Ar uname
4199b50d902SRodney W. Grimesis numeric and there is no such user name, then
4209b50d902SRodney W. Grimes.Ar uname
4219b50d902SRodney W. Grimesis treated as a user id.
4229b50d902SRodney W. Grimes.El
4239b50d902SRodney W. Grimes.Pp
4249b50d902SRodney W. GrimesAll primaries which take a numeric argument allow the number to be
4259b88faecSRuslan Ermilovpreceded by a plus sign
4269b88faecSRuslan Ermilov.Pq Dq +
4279b88faecSRuslan Ermilovor a minus sign
4289b88faecSRuslan Ermilov.Pq Dq - .
4299b50d902SRodney W. GrimesA preceding plus sign means ``more than n'', a preceding minus sign means
4309b50d902SRodney W. Grimes``less than n'' and neither means ``exactly n'' .
4319b50d902SRodney W. Grimes.Sh OPERATORS
4329b50d902SRodney W. GrimesThe primaries may be combined using the following operators.
4339b50d902SRodney W. GrimesThe operators are listed in order of decreasing precedence.
4349b50d902SRodney W. Grimes.Bl -tag -width (expression)
4350c101fb2SJoseph Koshy.It Cm \&( Ar expression Cm \&)
4369b50d902SRodney W. GrimesThis evaluates to true if the parenthesized expression evaluates to
4379b50d902SRodney W. Grimestrue.
4389b50d902SRodney W. Grimes.Pp
4390c101fb2SJoseph Koshy.It Cm \&! Ar expression
4409b50d902SRodney W. GrimesThis is the unary
4419b50d902SRodney W. Grimes.Tn NOT
4429b50d902SRodney W. Grimesoperator.
4439b50d902SRodney W. GrimesIt evaluates to true if the expression is false.
4449b50d902SRodney W. Grimes.Pp
4459b50d902SRodney W. Grimes.It Ar expression Cm -and Ar expression
4469b50d902SRodney W. Grimes.It Ar expression expression
4479b50d902SRodney W. GrimesThe
4489b50d902SRodney W. Grimes.Cm -and
4499b50d902SRodney W. Grimesoperator is the logical
4509b50d902SRodney W. Grimes.Tn AND
4519b50d902SRodney W. Grimesoperator.
4529b50d902SRodney W. GrimesAs it is implied by the juxtaposition of two expressions it does not
4539b50d902SRodney W. Grimeshave to be specified.
4549b50d902SRodney W. GrimesThe expression evaluates to true if both expressions are true.
4559b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is false.
4569b50d902SRodney W. Grimes.Pp
4579b50d902SRodney W. Grimes.It Ar expression Cm -or Ar expression
4589b50d902SRodney W. GrimesThe
4599b50d902SRodney W. Grimes.Cm -or
4609b50d902SRodney W. Grimesoperator is the logical
4619b50d902SRodney W. Grimes.Tn OR
4629b50d902SRodney W. Grimesoperator.
4639b50d902SRodney W. GrimesThe expression evaluates to true if either the first or the second expression
4649b50d902SRodney W. Grimesis true.
4659b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is true.
4669b50d902SRodney W. Grimes.El
4679b50d902SRodney W. Grimes.Pp
4689b50d902SRodney W. GrimesAll operands and primaries must be separate arguments to
4698fe908efSRuslan Ermilov.Nm .
4709b50d902SRodney W. GrimesPrimaries which themselves take arguments expect each argument
4719b50d902SRodney W. Grimesto be a separate argument to
4728fe908efSRuslan Ermilov.Nm .
4739b50d902SRodney W. Grimes.Sh EXAMPLES
4749b50d902SRodney W. Grimes.Pp
4759b50d902SRodney W. GrimesThe following examples are shown as given to the shell:
4769b50d902SRodney W. Grimes.Bl -tag -width findx
4779b50d902SRodney W. Grimes.It Li "find  /  \e!  -name  \*q*.c\*q  -print"
4789b50d902SRodney W. GrimesPrint out a list of all the files whose names do not end in ``.c''.
4799b50d902SRodney W. Grimes.It Li "find  /  -newer  ttt  -user  wnj  -print"
4809b50d902SRodney W. GrimesPrint out a list of all the files owned by user ``wnj'' that are newer
4819b50d902SRodney W. Grimesthan the file ``ttt''.
4829b50d902SRodney W. Grimes.It Li "find  /  \e!  \e(  -newer  ttt  -user  wnj  \e)  -print"
4839b50d902SRodney W. GrimesPrint out a list of all the files which are not both newer than ``ttt''
4849b50d902SRodney W. Grimesand owned by ``wnj''.
4859b50d902SRodney W. Grimes.It Li "find  /  \e(  -newer  ttt  -or  -user wnj  \e)  -print"
4869b50d902SRodney W. GrimesPrint out a list of all the files that are either owned by ``wnj'' or
4879b50d902SRodney W. Grimesthat are newer than ``ttt''.
4889b50d902SRodney W. Grimes.El
4899b50d902SRodney W. Grimes.Sh SEE ALSO
490567664c4SOllivier Robert.Xr chflags 1 ,
4919b50d902SRodney W. Grimes.Xr chmod 1 ,
4929b50d902SRodney W. Grimes.Xr locate 1 ,
49341cbb624SJoseph Koshy.Xr whereis 1 ,
49441cbb624SJoseph Koshy.Xr which 1 ,
4959b50d902SRodney W. Grimes.Xr stat 2 ,
4969b50d902SRodney W. Grimes.Xr fts 3 ,
4979b50d902SRodney W. Grimes.Xr getgrent 3 ,
4989b50d902SRodney W. Grimes.Xr getpwent 3 ,
4999b50d902SRodney W. Grimes.Xr strmode 3 ,
5009b50d902SRodney W. Grimes.Xr symlink 7
5019b50d902SRodney W. Grimes.Sh STANDARDS
5029b50d902SRodney W. GrimesThe
5038fe908efSRuslan Ermilov.Nm
5049b50d902SRodney W. Grimesutility syntax is a superset of the syntax specified by the
5059b50d902SRodney W. Grimes.St -p1003.2
5069b50d902SRodney W. Grimesstandard.
5079b50d902SRodney W. Grimes.Pp
508f6e4fb22SSteve PriceAll the single character options as well as the
509f6e4fb22SSteve Price.Ic -inum ,
510f6e4fb22SSteve Price.Ic -print0 ,
511f6e4fb22SSteve Price.Ic -delete ,
512f6e4fb22SSteve Priceand
513f6e4fb22SSteve Price.Ic -ls
514f6e4fb22SSteve Priceprimaries are extensions to
515f6e4fb22SSteve Price.St -p1003.2 .
516f6e4fb22SSteve Price.Pp
5179b50d902SRodney W. GrimesHistorically, the
5189b50d902SRodney W. Grimes.Fl d ,
5199b50d902SRodney W. Grimes.Fl h
5209b50d902SRodney W. Grimesand
5219b50d902SRodney W. Grimes.Fl x
5229b50d902SRodney W. Grimesoptions were implemented using the primaries ``\-depth'', ``\-follow'',
5239b50d902SRodney W. Grimesand ``\-xdev''.
5249b50d902SRodney W. GrimesThese primaries always evaluated to true.
5259b50d902SRodney W. GrimesAs they were really global variables that took effect before the traversal
5269b50d902SRodney W. Grimesbegan, some legal expressions could have unexpected results.
5279b50d902SRodney W. GrimesAn example is the expression ``\-print \-o \-depth''.
5289b50d902SRodney W. GrimesAs \-print always evaluates to true, the standard order of evaluation
5299b50d902SRodney W. Grimesimplies that \-depth would never be evaluated.
5309b50d902SRodney W. GrimesThis is not the case.
5319b50d902SRodney W. Grimes.Pp
5329b50d902SRodney W. GrimesThe operator ``-or'' was implemented as ``\-o'', and the operator ``-and''
5339b50d902SRodney W. Grimeswas implemented as ``\-a''.
5349b50d902SRodney W. Grimes.Pp
5359b50d902SRodney W. GrimesHistoric implementations of the
5369b50d902SRodney W. Grimes.Ic exec
5379b50d902SRodney W. Grimesand
5389b50d902SRodney W. Grimes.Ic ok
5399b50d902SRodney W. Grimesprimaries did not replace the string ``{}'' in the utility name or the
5409b50d902SRodney W. Grimesutility arguments if it had preceding or following non-whitespace characters.
5419b50d902SRodney W. GrimesThis version replaces it no matter where in the utility name or arguments
5429b50d902SRodney W. Grimesit appears.
5439b50d902SRodney W. Grimes.Sh BUGS
5449b50d902SRodney W. GrimesThe special characters used by
5458fe908efSRuslan Ermilov.Nm
5469b50d902SRodney W. Grimesare also special characters to many shell programs.
5479b50d902SRodney W. GrimesIn particular, the characters ``*'', ``['', ``]'', ``?'', ``('', ``)'',
5489b50d902SRodney W. Grimes``!'', ``\e'' and ``;'' may have to be escaped from the shell.
5499b50d902SRodney W. Grimes.Pp
5509b50d902SRodney W. GrimesAs there is no delimiter separating options and file names or file
5519b50d902SRodney W. Grimesnames and the
5529b50d902SRodney W. Grimes.Ar expression ,
5539b50d902SRodney W. Grimesit is difficult to specify files named ``-xdev'' or ``!''.
5549b50d902SRodney W. GrimesThese problems are handled by the
5559b50d902SRodney W. Grimes.Fl f
5569b50d902SRodney W. Grimesoption and the
5579b50d902SRodney W. Grimes.Xr getopt 3
5589b50d902SRodney W. Grimes``--'' construct.
559abacbbbfSPeter Wemm.Pp
560abacbbbfSPeter WemmThe
561abacbbbfSPeter Wemm.Ic -delete
56256f7a840SBill Fumerolaprimary does not interact well with other options that cause the filesystem
563abacbbbfSPeter Wemmtree traversal options to be changed.
564b8923d4cSWolfram Schneider.Sh HISTORY
565b8923d4cSWolfram SchneiderA
566b8923d4cSWolfram Schneider.Nm
567b8923d4cSWolfram Schneidercommand appeared in
568b8923d4cSWolfram Schneider.At v1 .
569