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 467c1d4b3aSAkinori MUSHA.Op Fl EXdsx 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 627c1d4b3aSAkinori MUSHA.It Fl E 637c1d4b3aSAkinori MUSHAInterpret regular expressions followed by 647c1d4b3aSAkinori MUSHA.Ic -regex 657c1d4b3aSAkinori MUSHAand 667c1d4b3aSAkinori MUSHA.Ic -iregex 677c1d4b3aSAkinori MUSHAoptions as extended (modern) regular expressions rather than basic 687c1d4b3aSAkinori MUSHAregular expressions (BRE's). The 697c1d4b3aSAkinori MUSHA.Xr re_format 7 707c1d4b3aSAkinori MUSHAmanual page fully describes both formats. 719b50d902SRodney W. Grimes.It Fl H 729b50d902SRodney W. GrimesThe 739b50d902SRodney W. Grimes.Fl H 749b50d902SRodney W. Grimesoption causes the file information and file type (see 759b50d902SRodney W. Grimes.Xr stat 2 ) 769b50d902SRodney W. Grimesreturned for each symbolic link specified on the command line to be 779b50d902SRodney W. Grimesthose of the file referenced by the link, not the link itself. 789b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will 796df69548SBruce Evansbe for the link itself. 806df69548SBruce EvansFile information of all symbolic links not on 819b50d902SRodney W. Grimesthe command line is that of the link itself. 829b50d902SRodney W. Grimes.It Fl L 839b50d902SRodney W. GrimesThe 849b50d902SRodney W. Grimes.Fl L 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 file referenced by the 889b50d902SRodney W. Grimeslink, not the link itself. 899b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will 909b50d902SRodney W. Grimesbe for the link itself. 919b50d902SRodney W. Grimes.It Fl P 929b50d902SRodney W. GrimesThe 939b50d902SRodney W. Grimes.Fl P 949b50d902SRodney W. Grimesoption causes the file information and file type (see 959b50d902SRodney W. Grimes.Xr stat 2 ) 969b50d902SRodney W. Grimesreturned for each symbolic link to be those of the link itself. 973d9a9402SJohn PolstraThis is the default. 989b50d902SRodney W. Grimes.It Fl X 999b50d902SRodney W. GrimesThe 1009b50d902SRodney W. Grimes.Fl X 1019b50d902SRodney W. Grimesoption is a modification to permit 1029b50d902SRodney W. Grimes.Nm 1039b50d902SRodney W. Grimesto be safely used in conjunction with 1049b50d902SRodney W. Grimes.Xr xargs 1 . 1059b50d902SRodney W. GrimesIf a file name contains any of the delimiting characters used by 1069b50d902SRodney W. Grimes.Xr xargs , 1079b50d902SRodney W. Grimesa diagnostic message is displayed on standard error, and the file 1089b50d902SRodney W. Grimesis skipped. 1099b50d902SRodney W. GrimesThe delimiting characters include single (`` ' '') and double (`` " '') 1109b50d902SRodney W. Grimesquotes, backslash (``\e''), space, tab and newline characters. 1119b50d902SRodney W. Grimes.It Fl d 1129b50d902SRodney W. GrimesThe 1139b50d902SRodney W. Grimes.Fl d 1149b50d902SRodney W. Grimesoption causes 1158fe908efSRuslan Ermilov.Nm 1169b50d902SRodney W. Grimesto perform a depth\-first traversal, i.e. directories 1179b50d902SRodney W. Grimesare visited in post\-order and all entries in a directory will be acted 1189b50d902SRodney W. Grimeson before the directory itself. 1199b50d902SRodney W. GrimesBy default, 1208fe908efSRuslan Ermilov.Nm 1219b50d902SRodney W. Grimesvisits directories in pre\-order, i.e. before their contents. 1229b50d902SRodney W. GrimesNote, the default is 1239b50d902SRodney W. Grimes.Ar not 1249b50d902SRodney W. Grimesa breadth\-first traversal. 1259b50d902SRodney W. Grimes.It Fl f 1269b50d902SRodney W. GrimesThe 1279b50d902SRodney W. Grimes.Fl f 1289b50d902SRodney W. Grimesoption specifies a file hierarchy for 1298fe908efSRuslan Ermilov.Nm 1309b50d902SRodney W. Grimesto traverse. 1319b50d902SRodney W. GrimesFile hierarchies may also be specified as the operands immediately 1329b50d902SRodney W. Grimesfollowing the options. 1336d0c7e13SWolfram Schneider.It Fl s 1346d0c7e13SWolfram SchneiderThe 1356d0c7e13SWolfram Schneider.Fl s 1366df69548SBruce Evansoption causes 1378fe908efSRuslan Ermilov.Nm 1386df69548SBruce Evansto traverse the file hierarchies in lexicographical order, 1396df69548SBruce Evansi.e., alphabetical order within each directory. 1406df69548SBruce EvansNote: 1416d0c7e13SWolfram Schneider.Sq find -s 1426d0c7e13SWolfram Schneiderand 1436d0c7e13SWolfram Schneider.So 1446d0c7e13SWolfram Schneiderfind | sort 1456d0c7e13SWolfram Schneider.Sc 1466d0c7e13SWolfram Schneidermay give different results. 1479b50d902SRodney W. Grimes.It Fl x 1489b50d902SRodney W. GrimesThe 1499b50d902SRodney W. Grimes.Fl x 1509b50d902SRodney W. Grimesoption prevents 1518fe908efSRuslan Ermilov.Nm 1529b50d902SRodney W. Grimesfrom descending into directories that have a device number different 1539b50d902SRodney W. Grimesthan that of the file from which the descent began. 1549b50d902SRodney W. Grimes.El 1559b50d902SRodney W. Grimes.Sh PRIMARIES 1569b50d902SRodney W. Grimes.Bl -tag -width Ds 1573f5223f8SWolfram Schneider.It Ic -amin Ar n 1583f5223f8SWolfram SchneiderTrue if the difference between the file last access time and the time 1598fe908efSRuslan Ermilov.Nm 16045fe9882SMatthew Huntwas started, rounded up to the next full minute, is 1613f5223f8SWolfram Schneider.Ar n 16245fe9882SMatthew Huntminutes. 1639b50d902SRodney W. Grimes.It Ic -atime Ar n 1649b50d902SRodney W. GrimesTrue if the difference between the file last access time and the time 1658fe908efSRuslan Ermilov.Nm 1669b50d902SRodney W. Grimeswas started, rounded up to the next full 24\-hour period, is 1679b50d902SRodney W. Grimes.Ar n 1689b50d902SRodney W. Grimes24\-hour periods. 1693f5223f8SWolfram Schneider.It Ic -cmin Ar n 1703f5223f8SWolfram SchneiderTrue if the difference between the time of last change of file status 1713f5223f8SWolfram Schneiderinformation and the time 1728fe908efSRuslan Ermilov.Nm 17345fe9882SMatthew Huntwas started, rounded up to the next full minute, is 1743f5223f8SWolfram Schneider.Ar n 17545fe9882SMatthew Huntminutes. 1769b50d902SRodney W. Grimes.It Ic -ctime Ar n 1779b50d902SRodney W. GrimesTrue if the difference between the time of last change of file status 1789b50d902SRodney W. Grimesinformation and the time 1798fe908efSRuslan Ermilov.Nm 1809b50d902SRodney W. Grimeswas started, rounded up to the next full 24\-hour period, is 1819b50d902SRodney W. Grimes.Ar n 1829b50d902SRodney W. Grimes24\-hour periods. 183abacbbbfSPeter Wemm.It Ic -delete 1846df69548SBruce EvansDelete found files and/or directories. 1856df69548SBruce EvansAlways returns true. 1866df69548SBruce EvansThis executes 187abacbbbfSPeter Wemmfrom the current working directory as 188abacbbbfSPeter Wemm.Nm 1896df69548SBruce Evansrecurses down the tree. 1906df69548SBruce EvansIt will not attempt to delete a filename with a ``/'' 1916ad98044SEivind Eklundcharacter in its pathname relative to "." for security reasons. 192abacbbbfSPeter WemmDepth\-first traversal processing is implied by this option. 193ed1a4621SPeter Wemm.It Ic -empty 194ed1a4621SPeter WemmTrue if the current file or directory is empty. 1959b50d902SRodney W. Grimes.It Ic -exec Ar utility Op argument ... ; 1969b50d902SRodney W. GrimesTrue if the program named 1979b50d902SRodney W. Grimes.Ar utility 1989b50d902SRodney W. Grimesreturns a zero value as its exit status. 1999b50d902SRodney W. GrimesOptional arguments may be passed to the utility. 2009b50d902SRodney W. GrimesThe expression must be terminated by a semicolon (``;''). 2019b50d902SRodney W. GrimesIf the string ``{}'' appears anywhere in the utility name or the 2029b50d902SRodney W. Grimesarguments it is replaced by the pathname of the current file. 2039b50d902SRodney W. Grimes.Ar Utility 2049b50d902SRodney W. Grimeswill be executed from the directory from which 2058fe908efSRuslan Ermilov.Nm 2069b50d902SRodney W. Grimeswas executed. 207127d7563SWarner Losh.It Ic -execdir Ar utility Op argument ... ; 208127d7563SWarner LoshThe 209127d7563SWarner Losh.Ic \&-execdir 210127d7563SWarner Loshprimary is identical to the 211127d7563SWarner Losh.Ic -exec 212127d7563SWarner Loshprimary with the exception that 213127d7563SWarner Losh.Ar Utility 214127d7563SWarner Loshwill be executed from the directory that holds 2156df69548SBruce Evansthe current file. 2166df69548SBruce EvansThe filename substituted for 217127d7563SWarner Loshthe string ``{}'' is not qualified. 2189b50d902SRodney W. Grimes.It Ic -fstype Ar type 2199b50d902SRodney W. GrimesTrue if the file is contained in a file system of type 2209b50d902SRodney W. Grimes.Ar type . 221841484cdSPeter WemmThe 222841484cdSPeter Wemm.Xr sysctl 8 223841484cdSPeter Wemmcommand can be used to find out the types of filesystems 224841484cdSPeter Wemmthat are available on the system: 225841484cdSPeter Wemm.Bd -literal -offset indent 226841484cdSPeter Wemmsysctl vfs 227841484cdSPeter Wemm.Ed 228841484cdSPeter WemmIn addition, there are two pseudo-types, ``local'' and ``rdonly''. 2299b50d902SRodney W. GrimesThe former matches any file system physically mounted on the system where 2309b50d902SRodney W. Grimesthe 2318fe908efSRuslan Ermilov.Nm 2329b50d902SRodney W. Grimesis being executed and the latter matches any file system which is 2339b50d902SRodney W. Grimesmounted read-only. 2349b50d902SRodney W. Grimes.It Ic -group Ar gname 2359b50d902SRodney W. GrimesTrue if the file belongs to the group 2369b50d902SRodney W. Grimes.Ar gname . 2379b50d902SRodney W. GrimesIf 2389b50d902SRodney W. Grimes.Ar gname 2399b50d902SRodney W. Grimesis numeric and there is no such group name, then 2409b50d902SRodney W. Grimes.Ar gname 2419b50d902SRodney W. Grimesis treated as a group id. 2429b50d902SRodney W. Grimes.It Ic -inum Ar n 2439b50d902SRodney W. GrimesTrue if the file has inode number 2449b50d902SRodney W. Grimes.Ar n . 2459b50d902SRodney W. Grimes.It Ic -links Ar n 2469b50d902SRodney W. GrimesTrue if the file has 2479b50d902SRodney W. Grimes.Ar n 2489b50d902SRodney W. Grimeslinks. 2499b50d902SRodney W. Grimes.It Ic -ls 2509b50d902SRodney W. GrimesThis primary always evaluates to true. 2519b50d902SRodney W. GrimesThe following information for the current file is written to standard output: 2529b50d902SRodney W. Grimesits inode number, size in 512\-byte blocks, file permissions, number of hard 2539b50d902SRodney W. Grimeslinks, owner, group, size in bytes, last modification time, and pathname. 2549b50d902SRodney W. GrimesIf the file is a block or character special file, the major and minor numbers 2559b50d902SRodney W. Grimeswill be displayed instead of the size in bytes. 2569b50d902SRodney W. GrimesIf the file is a symbolic link, the pathname of the linked\-to file will be 2579b50d902SRodney W. Grimesdisplayed preceded by ``\->''. 2589b50d902SRodney W. GrimesThe format is identical to that produced by ``ls \-dgils''. 259c76bc8f3SOllivier Robert.It Ic -maxdepth Ar n 260c76bc8f3SOllivier RobertTrue if the depth of the current file into the tree is less than or equal to 261c76bc8f3SOllivier Robert.Ar n . 262c76bc8f3SOllivier Robert.It Ic -mindepth Ar n 263c76bc8f3SOllivier RobertTrue if the depth of the current file into the tree is greater than or equal to 264c76bc8f3SOllivier Robert.Ar n . 2653f5223f8SWolfram Schneider.It Ic -mmin Ar n 2663f5223f8SWolfram SchneiderTrue if the difference between the file last modification time and the time 2678fe908efSRuslan Ermilov.Nm 26845fe9882SMatthew Huntwas started, rounded up to the next full minute, is 2693f5223f8SWolfram Schneider.Ar n 27045fe9882SMatthew Huntminutes. 2719b50d902SRodney W. Grimes.It Ic -mtime Ar n 2729b50d902SRodney W. GrimesTrue if the difference between the file last modification time and the time 2738fe908efSRuslan Ermilov.Nm 2749b50d902SRodney W. Grimeswas started, rounded up to the next full 24\-hour period, is 2759b50d902SRodney W. Grimes.Ar n 2769b50d902SRodney W. Grimes24\-hour periods. 277841484cdSPeter Wemm.It Ic \&-ok Ar utility Op argument ... ; 2789b50d902SRodney W. GrimesThe 2799b50d902SRodney W. Grimes.Ic \&-ok 2809b50d902SRodney W. Grimesprimary is identical to the 2819b50d902SRodney W. Grimes.Ic -exec 2829b50d902SRodney W. Grimesprimary with the exception that 2838fe908efSRuslan Ermilov.Nm 2849b50d902SRodney W. Grimesrequests user affirmation for the execution of the utility by printing 2859b50d902SRodney W. Grimesa message to the terminal and reading a response. 2869b50d902SRodney W. GrimesIf the response is other than ``y'' the command is not executed and the 2879b50d902SRodney W. Grimesvalue of the 2889b50d902SRodney W. Grimes.Ar \&ok 2899b50d902SRodney W. Grimesexpression is false. 2909b50d902SRodney W. Grimes.It Ic -name Ar pattern 2919b50d902SRodney W. GrimesTrue if the last component of the pathname being examined matches 2929b50d902SRodney W. Grimes.Ar pattern . 2939b50d902SRodney W. GrimesSpecial shell pattern matching characters (``['', ``]'', ``*'', and ``?'') 2949b50d902SRodney W. Grimesmay be used as part of 2959b50d902SRodney W. Grimes.Ar pattern . 2969b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a 2979b50d902SRodney W. Grimesbackslash (``\e''). 2987c1d4b3aSAkinori MUSHA.It Ic -iname Ar pattern 2997c1d4b3aSAkinori MUSHALike 3007c1d4b3aSAkinori MUSHA.Ic -name , 3017c1d4b3aSAkinori MUSHAbut the match is case insensitive. 3027c1d4b3aSAkinori MUSHA.It Ic -regex Ar pattern 3037c1d4b3aSAkinori MUSHATrue if the whole path of the file matches 3047c1d4b3aSAkinori MUSHA.Ar pattern 3057c1d4b3aSAkinori MUSHAusing regular expression. To match a file named ``./foo/xyzzy'', you 3067c1d4b3aSAkinori MUSHAcan use the regular expression ``.*/[xyz]*'' or ``.*/foo/.*'', but not 3077c1d4b3aSAkinori MUSHA``xyzzy'' or ``/foo/''. 3087c1d4b3aSAkinori MUSHA.It Ic -iregex Ar pattern 3097c1d4b3aSAkinori MUSHALike 3107c1d4b3aSAkinori MUSHA.Ic -regex , 3117c1d4b3aSAkinori MUSHAbut the match is case insensitive. 3129b50d902SRodney W. Grimes.It Ic -newer Ar file 3139b50d902SRodney W. GrimesTrue if the current file has a more recent last modification time than 3149b50d902SRodney W. Grimes.Ar file . 3159b50d902SRodney W. Grimes.It Ic -nouser 3169b50d902SRodney W. GrimesTrue if the file belongs to an unknown user. 3179b50d902SRodney W. Grimes.It Ic -nogroup 3189b50d902SRodney W. GrimesTrue if the file belongs to an unknown group. 3199b50d902SRodney W. Grimes.It Ic -path Ar pattern 3209b50d902SRodney W. GrimesTrue if the pathname being examined matches 3219b50d902SRodney W. Grimes.Ar pattern . 3229b50d902SRodney W. GrimesSpecial shell pattern matching characters (``['', ``]'', ``*'', and ``?'') 3239b50d902SRodney W. Grimesmay be used as part of 3249b50d902SRodney W. Grimes.Ar pattern . 3259b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a 3269b50d902SRodney W. Grimesbackslash (``\e''). 3279b50d902SRodney W. GrimesSlashes (``/'') are treated as normal characters and do not have to be 3289b50d902SRodney W. Grimesmatched explicitly. 3297c1d4b3aSAkinori MUSHA.It Ic -ipath Ar pattern 3307c1d4b3aSAkinori MUSHALike 3317c1d4b3aSAkinori MUSHA.Ic -path , 3327c1d4b3aSAkinori MUSHAbut the match is case insensitive. 333b9569cadSKris Kennaway.It Xo 334b9569cadSKris Kennaway.Ic -perm 335d0353b83SRuslan Ermilov.Oo Fl Oc Ns Ar mode 336b9569cadSKris Kennaway.Xc 3379b50d902SRodney W. GrimesThe 3389b50d902SRodney W. Grimes.Ar mode 3399b50d902SRodney W. Grimesmay be either symbolic (see 3409b50d902SRodney W. Grimes.Xr chmod 1 ) 3419b50d902SRodney W. Grimesor an octal number. 3429b50d902SRodney W. GrimesIf the mode is symbolic, a starting value of zero is assumed and the 3439b50d902SRodney W. Grimesmode sets or clears permissions without regard to the process' file mode 3449b50d902SRodney W. Grimescreation mask. 3459b50d902SRodney W. GrimesIf the mode is octal, only bits 07777 3469b50d902SRodney W. Grimes.Pf ( Dv S_ISUID 3479b50d902SRodney W. Grimes| 3489b50d902SRodney W. Grimes.Dv S_ISGID 3499b50d902SRodney W. Grimes| 3509b50d902SRodney W. Grimes.Dv S_ISTXT 3519b50d902SRodney W. Grimes| 3529b50d902SRodney W. Grimes.Dv S_IRWXU 3539b50d902SRodney W. Grimes| 3549b50d902SRodney W. Grimes.Dv S_IRWXG 3559b50d902SRodney W. Grimes| 3569b50d902SRodney W. Grimes.Dv S_IRWXO ) 3579b50d902SRodney W. Grimesof the file's mode bits participate 3589b50d902SRodney W. Grimesin the comparison. 3599b88faecSRuslan ErmilovIf the mode is preceded by a dash 3609b88faecSRuslan Ermilov.Pq Dq - , 3619b88faecSRuslan Ermilovthis primary evaluates to true 3629b50d902SRodney W. Grimesif at least all of the bits in the mode are set in the file's mode bits. 3639b88faecSRuslan ErmilovIf the mode is preceded by a plus 3649b88faecSRuslan Ermilov.Pq Dq + , 3659b88faecSRuslan Ermilovthis primary evaluates to true 3669d2796c3SOllivier Robertif any of the bits in the mode are set in the file's mode bits. 3679d2796c3SOllivier RobertOtherwise, this primary evaluates to true if 3689b50d902SRodney W. Grimesthe bits in the mode exactly match the file's mode bits. 3699b50d902SRodney W. GrimesNote, the first character of a symbolic mode may not be a dash (``\-''). 370567664c4SOllivier Robert.It Ic -flags Op Fl Ns Ar flags 371567664c4SOllivier RobertThis primary evaluates to true if exactly those flags of the file are 372567664c4SOllivier Robertset which are also set using the specified 373567664c4SOllivier Robert.Ar flags 374567664c4SOllivier Robert(if these are not preceded by a dash (``\-''), 375567664c4SOllivier Robertor if they match the specified flags (if these are preceded by a dash). 376567664c4SOllivier RobertThe 377567664c4SOllivier Robert.Ar flags 378567664c4SOllivier Robertare specified using symbolic names (see 379567664c4SOllivier Robert.Xr chflags 1 ) . 380567664c4SOllivier RobertNote that this is different from 381567664c4SOllivier Robert.Ic -perm , 382567664c4SOllivier Robertwhich only allows you to specify flags which are set. 3839b50d902SRodney W. Grimes.It Ic -print 3849b50d902SRodney W. GrimesThis primary always evaluates to true. 3859b50d902SRodney W. GrimesIt prints the pathname of the current file to standard output. 386841484cdSPeter WemmIf none of 3879b50d902SRodney W. Grimes.Ic -exec , 3887cd23434SGarrett Wollman.Ic -ls , 3897cd23434SGarrett Wollman.Ic -print0 , 3909b50d902SRodney W. Grimesor 3919b50d902SRodney W. Grimes.Ic \&-ok 392841484cdSPeter Wemmis specified, the given expression shall be effectively replaced by 393841484cdSPeter Wemm.Cm \&( Ns Ar given\& expression Ns Cm \&) 394841484cdSPeter Wemm.Ic -print . 3957cd23434SGarrett Wollman.It Ic -print0 3967cd23434SGarrett WollmanThis primary always evaluates to true. 397fbe0d04aSMasafumi Max NAKANEIt prints the pathname of the current file to standard output, followed by an 3987cd23434SGarrett Wollman.Tn ASCII 3997cd23434SGarrett Wollman.Tn NUL 4007cd23434SGarrett Wollmancharacter (character code 0). 4019b50d902SRodney W. Grimes.It Ic -prune 4029b50d902SRodney W. GrimesThis primary always evaluates to true. 4039b50d902SRodney W. GrimesIt causes 4048fe908efSRuslan Ermilov.Nm 4059b50d902SRodney W. Grimesto not descend into the current file. 4069b50d902SRodney W. GrimesNote, the 4079b50d902SRodney W. Grimes.Ic -prune 4089b50d902SRodney W. Grimesprimary has no effect if the 4099b50d902SRodney W. Grimes.Fl d 4109b50d902SRodney W. Grimesoption was specified. 4119b50d902SRodney W. Grimes.It Ic -size Ar n Ns Op Cm c 4129b50d902SRodney W. GrimesTrue if the file's size, rounded up, in 512\-byte blocks is 4139b50d902SRodney W. Grimes.Ar n . 4149b50d902SRodney W. GrimesIf 4159b50d902SRodney W. Grimes.Ar n 4169b50d902SRodney W. Grimesis followed by a ``c'', then the primary is true if the 4179b50d902SRodney W. Grimesfile's size is 4189b50d902SRodney W. Grimes.Ar n 4199b50d902SRodney W. Grimesbytes. 4209b50d902SRodney W. Grimes.It Ic -type Ar t 4219b50d902SRodney W. GrimesTrue if the file is of the specified type. 4229b50d902SRodney W. GrimesPossible file types are as follows: 4239b50d902SRodney W. Grimes.Pp 4249b50d902SRodney W. Grimes.Bl -tag -width flag -offset indent -compact 4259b50d902SRodney W. Grimes.It Cm b 4269b50d902SRodney W. Grimesblock special 4279b50d902SRodney W. Grimes.It Cm c 4289b50d902SRodney W. Grimescharacter special 4299b50d902SRodney W. Grimes.It Cm d 4309b50d902SRodney W. Grimesdirectory 4319b50d902SRodney W. Grimes.It Cm f 4329b50d902SRodney W. Grimesregular file 4339b50d902SRodney W. Grimes.It Cm l 4349b50d902SRodney W. Grimessymbolic link 4359b50d902SRodney W. Grimes.It Cm p 4369b50d902SRodney W. GrimesFIFO 4379b50d902SRodney W. Grimes.It Cm s 4389b50d902SRodney W. Grimessocket 4399b50d902SRodney W. Grimes.El 4409b50d902SRodney W. Grimes.Pp 4419b50d902SRodney W. Grimes.It Ic -user Ar uname 4429b50d902SRodney W. GrimesTrue if the file belongs to the user 4439b50d902SRodney W. Grimes.Ar uname . 4449b50d902SRodney W. GrimesIf 4459b50d902SRodney W. Grimes.Ar uname 4469b50d902SRodney W. Grimesis numeric and there is no such user name, then 4479b50d902SRodney W. Grimes.Ar uname 4489b50d902SRodney W. Grimesis treated as a user id. 4499b50d902SRodney W. Grimes.El 4509b50d902SRodney W. Grimes.Pp 4519b50d902SRodney W. GrimesAll primaries which take a numeric argument allow the number to be 4529b88faecSRuslan Ermilovpreceded by a plus sign 4539b88faecSRuslan Ermilov.Pq Dq + 4549b88faecSRuslan Ermilovor a minus sign 4559b88faecSRuslan Ermilov.Pq Dq - . 4569b50d902SRodney W. GrimesA preceding plus sign means ``more than n'', a preceding minus sign means 4579b50d902SRodney W. Grimes``less than n'' and neither means ``exactly n'' . 4589b50d902SRodney W. Grimes.Sh OPERATORS 4599b50d902SRodney W. GrimesThe primaries may be combined using the following operators. 4609b50d902SRodney W. GrimesThe operators are listed in order of decreasing precedence. 4619b50d902SRodney W. Grimes.Bl -tag -width (expression) 4620c101fb2SJoseph Koshy.It Cm \&( Ar expression Cm \&) 4639b50d902SRodney W. GrimesThis evaluates to true if the parenthesized expression evaluates to 4649b50d902SRodney W. Grimestrue. 4659b50d902SRodney W. Grimes.Pp 4660c101fb2SJoseph Koshy.It Cm \&! Ar expression 4679b50d902SRodney W. GrimesThis is the unary 4689b50d902SRodney W. Grimes.Tn NOT 4699b50d902SRodney W. Grimesoperator. 4709b50d902SRodney W. GrimesIt evaluates to true if the expression is false. 4719b50d902SRodney W. Grimes.Pp 4729b50d902SRodney W. Grimes.It Ar expression Cm -and Ar expression 4739b50d902SRodney W. Grimes.It Ar expression expression 4749b50d902SRodney W. GrimesThe 4759b50d902SRodney W. Grimes.Cm -and 4769b50d902SRodney W. Grimesoperator is the logical 4779b50d902SRodney W. Grimes.Tn AND 4789b50d902SRodney W. Grimesoperator. 4799b50d902SRodney W. GrimesAs it is implied by the juxtaposition of two expressions it does not 4809b50d902SRodney W. Grimeshave to be specified. 4819b50d902SRodney W. GrimesThe expression evaluates to true if both expressions are true. 4829b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is false. 4839b50d902SRodney W. Grimes.Pp 4849b50d902SRodney W. Grimes.It Ar expression Cm -or Ar expression 4859b50d902SRodney W. GrimesThe 4869b50d902SRodney W. Grimes.Cm -or 4879b50d902SRodney W. Grimesoperator is the logical 4889b50d902SRodney W. Grimes.Tn OR 4899b50d902SRodney W. Grimesoperator. 4909b50d902SRodney W. GrimesThe expression evaluates to true if either the first or the second expression 4919b50d902SRodney W. Grimesis true. 4929b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is true. 4939b50d902SRodney W. Grimes.El 4949b50d902SRodney W. Grimes.Pp 4959b50d902SRodney W. GrimesAll operands and primaries must be separate arguments to 4968fe908efSRuslan Ermilov.Nm . 4979b50d902SRodney W. GrimesPrimaries which themselves take arguments expect each argument 4989b50d902SRodney W. Grimesto be a separate argument to 4998fe908efSRuslan Ermilov.Nm . 5009b50d902SRodney W. Grimes.Sh EXAMPLES 5019b50d902SRodney W. Grimes.Pp 5029b50d902SRodney W. GrimesThe following examples are shown as given to the shell: 5039b50d902SRodney W. Grimes.Bl -tag -width findx 5049b50d902SRodney W. Grimes.It Li "find / \e! -name \*q*.c\*q -print" 5059b50d902SRodney W. GrimesPrint out a list of all the files whose names do not end in ``.c''. 5069b50d902SRodney W. Grimes.It Li "find / -newer ttt -user wnj -print" 5079b50d902SRodney W. GrimesPrint out a list of all the files owned by user ``wnj'' that are newer 5089b50d902SRodney W. Grimesthan the file ``ttt''. 5099b50d902SRodney W. Grimes.It Li "find / \e! \e( -newer ttt -user wnj \e) -print" 5109b50d902SRodney W. GrimesPrint out a list of all the files which are not both newer than ``ttt'' 5119b50d902SRodney W. Grimesand owned by ``wnj''. 5129b50d902SRodney W. Grimes.It Li "find / \e( -newer ttt -or -user wnj \e) -print" 5139b50d902SRodney W. GrimesPrint out a list of all the files that are either owned by ``wnj'' or 5149b50d902SRodney W. Grimesthat are newer than ``ttt''. 5159b50d902SRodney W. Grimes.El 5169b50d902SRodney W. Grimes.Sh SEE ALSO 5177c1d4b3aSAkinori MUSHA.Xr re_format 7, 518567664c4SOllivier Robert.Xr chflags 1 , 5199b50d902SRodney W. Grimes.Xr chmod 1 , 5209b50d902SRodney W. Grimes.Xr locate 1 , 52141cbb624SJoseph Koshy.Xr whereis 1 , 52241cbb624SJoseph Koshy.Xr which 1 , 5239b50d902SRodney W. Grimes.Xr stat 2 , 5249b50d902SRodney W. Grimes.Xr fts 3 , 5259b50d902SRodney W. Grimes.Xr getgrent 3 , 5269b50d902SRodney W. Grimes.Xr getpwent 3 , 5279b50d902SRodney W. Grimes.Xr strmode 3 , 5289b50d902SRodney W. Grimes.Xr symlink 7 5299b50d902SRodney W. Grimes.Sh STANDARDS 5309b50d902SRodney W. GrimesThe 5318fe908efSRuslan Ermilov.Nm 5329b50d902SRodney W. Grimesutility syntax is a superset of the syntax specified by the 5339b50d902SRodney W. Grimes.St -p1003.2 5349b50d902SRodney W. Grimesstandard. 5359b50d902SRodney W. Grimes.Pp 536f6e4fb22SSteve PriceAll the single character options as well as the 5377c1d4b3aSAkinori MUSHA.Ic -iname , 538f6e4fb22SSteve Price.Ic -inum , 5397c1d4b3aSAkinori MUSHA.Ic -iregex , 540f6e4fb22SSteve Price.Ic -print0 , 541f6e4fb22SSteve Price.Ic -delete , 5427c1d4b3aSAkinori MUSHA.Ic -ls , 543f6e4fb22SSteve Priceand 5447c1d4b3aSAkinori MUSHA.Ic -regex 545f6e4fb22SSteve Priceprimaries are extensions to 546f6e4fb22SSteve Price.St -p1003.2 . 547f6e4fb22SSteve Price.Pp 5489b50d902SRodney W. GrimesHistorically, the 5499b50d902SRodney W. Grimes.Fl d , 5509b50d902SRodney W. Grimes.Fl h 5519b50d902SRodney W. Grimesand 5529b50d902SRodney W. Grimes.Fl x 5539b50d902SRodney W. Grimesoptions were implemented using the primaries ``\-depth'', ``\-follow'', 5549b50d902SRodney W. Grimesand ``\-xdev''. 5559b50d902SRodney W. GrimesThese primaries always evaluated to true. 5569b50d902SRodney W. GrimesAs they were really global variables that took effect before the traversal 5579b50d902SRodney W. Grimesbegan, some legal expressions could have unexpected results. 5589b50d902SRodney W. GrimesAn example is the expression ``\-print \-o \-depth''. 5599b50d902SRodney W. GrimesAs \-print always evaluates to true, the standard order of evaluation 5609b50d902SRodney W. Grimesimplies that \-depth would never be evaluated. 5619b50d902SRodney W. GrimesThis is not the case. 5629b50d902SRodney W. Grimes.Pp 5639b50d902SRodney W. GrimesThe operator ``-or'' was implemented as ``\-o'', and the operator ``-and'' 5649b50d902SRodney W. Grimeswas implemented as ``\-a''. 5659b50d902SRodney W. Grimes.Pp 5669b50d902SRodney W. GrimesHistoric implementations of the 5679b50d902SRodney W. Grimes.Ic exec 5689b50d902SRodney W. Grimesand 5699b50d902SRodney W. Grimes.Ic ok 5709b50d902SRodney W. Grimesprimaries did not replace the string ``{}'' in the utility name or the 5719b50d902SRodney W. Grimesutility arguments if it had preceding or following non-whitespace characters. 5729b50d902SRodney W. GrimesThis version replaces it no matter where in the utility name or arguments 5739b50d902SRodney W. Grimesit appears. 5747c1d4b3aSAkinori MUSHA.Pp 5757c1d4b3aSAkinori MUSHAThe 5767c1d4b3aSAkinori MUSHA.Fl E 5777c1d4b3aSAkinori MUSHAoption was implemented on the analogy of 5787c1d4b3aSAkinori MUSHA.Xr grep 1 5797c1d4b3aSAkinori MUSHAand 5807c1d4b3aSAkinori MUSHA.Xr sed 1 . 5819b50d902SRodney W. Grimes.Sh BUGS 5829b50d902SRodney W. GrimesThe special characters used by 5838fe908efSRuslan Ermilov.Nm 5849b50d902SRodney W. Grimesare also special characters to many shell programs. 5859b50d902SRodney W. GrimesIn particular, the characters ``*'', ``['', ``]'', ``?'', ``('', ``)'', 5869b50d902SRodney W. Grimes``!'', ``\e'' and ``;'' may have to be escaped from the shell. 5879b50d902SRodney W. Grimes.Pp 5889b50d902SRodney W. GrimesAs there is no delimiter separating options and file names or file 5899b50d902SRodney W. Grimesnames and the 5909b50d902SRodney W. Grimes.Ar expression , 5919b50d902SRodney W. Grimesit is difficult to specify files named ``-xdev'' or ``!''. 5929b50d902SRodney W. GrimesThese problems are handled by the 5939b50d902SRodney W. Grimes.Fl f 5949b50d902SRodney W. Grimesoption and the 5959b50d902SRodney W. Grimes.Xr getopt 3 5969b50d902SRodney W. Grimes``--'' construct. 597abacbbbfSPeter Wemm.Pp 598abacbbbfSPeter WemmThe 599abacbbbfSPeter Wemm.Ic -delete 60056f7a840SBill Fumerolaprimary does not interact well with other options that cause the filesystem 601abacbbbfSPeter Wemmtree traversal options to be changed. 602b8923d4cSWolfram Schneider.Sh HISTORY 603b8923d4cSWolfram SchneiderA 604b8923d4cSWolfram Schneider.Nm 605b8923d4cSWolfram Schneidercommand appeared in 606b8923d4cSWolfram Schneider.At v1 . 607