158540776STim J. Robbins.\" Copyright (c) 1990, 1993 29b50d902SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 39b50d902SRodney W. Grimes.\" 49b50d902SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 59b50d902SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc. 69b50d902SRodney W. Grimes.\" 79b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 89b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions 99b50d902SRodney W. Grimes.\" are met: 109b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 119b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 129b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 139b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 149b50d902SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 159b50d902SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software 169b50d902SRodney W. Grimes.\" must display the following acknowledgement: 179b50d902SRodney W. Grimes.\" This product includes software developed by the University of 189b50d902SRodney W. Grimes.\" California, Berkeley and its contributors. 199b50d902SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors 209b50d902SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 219b50d902SRodney W. Grimes.\" without specific prior written permission. 229b50d902SRodney W. Grimes.\" 239b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 249b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 259b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 269b50d902SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 279b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 289b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 299b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 309b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 319b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 329b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 339b50d902SRodney W. Grimes.\" SUCH DAMAGE. 349b50d902SRodney W. Grimes.\" 35841484cdSPeter Wemm.\" @(#)find.1 8.7 (Berkeley) 5/9/95 36c3aac50fSPeter Wemm.\" $FreeBSD$ 379b50d902SRodney W. Grimes.\" 38ef6c7764STim J. Robbins.Dd April 2, 2005 399b50d902SRodney W. Grimes.Dt FIND 1 409b50d902SRodney W. Grimes.Os 419b50d902SRodney W. Grimes.Sh NAME 429b50d902SRodney W. Grimes.Nm find 439b50d902SRodney W. Grimes.Nd walk a file hierarchy 449b50d902SRodney W. Grimes.Sh SYNOPSIS 458fe908efSRuslan Ermilov.Nm 469b50d902SRodney W. Grimes.Op Fl H | Fl L | Fl P 477c1d4b3aSAkinori MUSHA.Op Fl EXdsx 480c101fb2SJoseph Koshy.Op Fl f Ar pathname 49bfd12208SRuslan Ermilov.Op Ar pathname ... 509b50d902SRodney W. Grimes.Ar expression 519b50d902SRodney W. Grimes.Sh DESCRIPTION 52e8937ba0SPhilippe CharnierThe 53e8937ba0SPhilippe Charnier.Nm 54e8937ba0SPhilippe Charnierutility recursively descends the directory tree for each 550c101fb2SJoseph Koshy.Ar pathname 569b50d902SRodney W. Grimeslisted, evaluating an 579b50d902SRodney W. Grimes.Ar expression 58bfd12208SRuslan Ermilov(composed of the 59bfd12208SRuslan Ermilov.Dq primaries 60bfd12208SRuslan Ermilovand 61bfd12208SRuslan Ermilov.Dq operands 62bfd12208SRuslan Ermilovlisted below) in terms 639b50d902SRodney W. Grimesof each file in the tree. 649b50d902SRodney W. Grimes.Pp 659b50d902SRodney W. GrimesThe options are as follows: 66bfd12208SRuslan Ermilov.Bl -tag -width indent 677c1d4b3aSAkinori MUSHA.It Fl E 687c1d4b3aSAkinori MUSHAInterpret regular expressions followed by 697c1d4b3aSAkinori MUSHA.Ic -regex 707c1d4b3aSAkinori MUSHAand 717c1d4b3aSAkinori MUSHA.Ic -iregex 727c1d4b3aSAkinori MUSHAoptions as extended (modern) regular expressions rather than basic 73bfd12208SRuslan Ermilovregular expressions (BRE's). 74bfd12208SRuslan ErmilovThe 757c1d4b3aSAkinori MUSHA.Xr re_format 7 767c1d4b3aSAkinori MUSHAmanual page fully describes both formats. 779b50d902SRodney W. Grimes.It Fl H 783c94f41fSPhilippe CharnierCause the file information and file type (see 799b50d902SRodney W. Grimes.Xr stat 2 ) 809b50d902SRodney W. Grimesreturned for each symbolic link specified on the command line to be 819b50d902SRodney W. Grimesthose of the file referenced by the link, not the link itself. 829b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will 836df69548SBruce Evansbe for the link itself. 846df69548SBruce EvansFile information of all symbolic links not on 859b50d902SRodney W. Grimesthe command line is that of the link itself. 869b50d902SRodney W. Grimes.It Fl L 873c94f41fSPhilippe CharnierCause the file information and file type (see 889b50d902SRodney W. Grimes.Xr stat 2 ) 899b50d902SRodney W. Grimesreturned for each symbolic link to be those of the file referenced by the 909b50d902SRodney W. Grimeslink, not the link itself. 919b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will 929b50d902SRodney W. Grimesbe for the link itself. 9347d91ba3SDag-Erling Smørgrav.Pp 9447d91ba3SDag-Erling SmørgravThis option is equivalent to the deprecated 9547d91ba3SDag-Erling Smørgrav.Ic -follow 9647d91ba3SDag-Erling Smørgravprimary. 979b50d902SRodney W. Grimes.It Fl P 983c94f41fSPhilippe CharnierCause the file information and file type (see 999b50d902SRodney W. Grimes.Xr stat 2 ) 1009b50d902SRodney W. Grimesreturned for each symbolic link to be those of the link itself. 1013d9a9402SJohn PolstraThis is the default. 1029b50d902SRodney W. Grimes.It Fl X 1033c94f41fSPhilippe CharnierPermit 1049b50d902SRodney W. Grimes.Nm 1059b50d902SRodney W. Grimesto be safely used in conjunction with 1069b50d902SRodney W. Grimes.Xr xargs 1 . 1079b50d902SRodney W. GrimesIf a file name contains any of the delimiting characters used by 108bfd12208SRuslan Ermilov.Xr xargs 1 , 1099b50d902SRodney W. Grimesa diagnostic message is displayed on standard error, and the file 1109b50d902SRodney W. Grimesis skipped. 111bfd12208SRuslan ErmilovThe delimiting characters include single 112bfd12208SRuslan Ermilov.Pq Dq Li " ' " 113bfd12208SRuslan Ermilovand double 114bfd12208SRuslan Ermilov.Pq Dq Li " \*q " 115bfd12208SRuslan Ermilovquotes, backslash 116bfd12208SRuslan Ermilov.Pq Dq Li \e , 117bfd12208SRuslan Ermilovspace, tab and newline characters. 118a8d50686STom Rhodes.Pp 119a8d50686STom RhodesHowever, you may wish to consider the 120a8d50686STom Rhodes.Fl print0 121a8d50686STom Rhodesprimary in conjunction with 122e2f8ed51SRuslan Ermilov.Dq Nm xargs Fl 0 123a8d50686STom Rhodesas an effective alternative. 1249b50d902SRodney W. Grimes.It Fl d 1253c94f41fSPhilippe CharnierCause 1268fe908efSRuslan Ermilov.Nm 12754874bb6SRuslan Ermilovto perform a depth-first traversal, i.e., directories 12854874bb6SRuslan Ermilovare visited in post-order and all entries in a directory will be acted 1299b50d902SRodney W. Grimeson before the directory itself. 1309b50d902SRodney W. GrimesBy default, 1318fe908efSRuslan Ermilov.Nm 13254874bb6SRuslan Ermilovvisits directories in pre-order, i.e., before their contents. 1339b50d902SRodney W. GrimesNote, the default is 134bfd12208SRuslan Ermilov.Em not 13554874bb6SRuslan Ermilova breadth-first traversal. 13647d91ba3SDag-Erling Smørgrav.Pp 1371c832963SOliver EikemeierThis option is equivalent to the 13847d91ba3SDag-Erling Smørgrav.Ic -depth 1391c832963SOliver Eikemeierprimary of 1401c832963SOliver Eikemeier.St -p1003.1-2001 . 1411c832963SOliver Eikemeier.Fl d 1421c832963SOliver Eikemeiercan be useful when 1431c832963SOliver Eikemeier.Nm 1441c832963SOliver Eikemeieris used with 1451c832963SOliver Eikemeier.Xr cpio 1 1461c832963SOliver Eikemeierto process files that are contained in directories with unusual permissions. 1471c832963SOliver EikemeierIt ensures that you have write permission while you are placing files in a 1481c832963SOliver Eikemeierdirectory, then sets the directory's permissions as the last thing. 1499b50d902SRodney W. Grimes.It Fl f 1503c94f41fSPhilippe CharnierSpecify a file hierarchy for 1518fe908efSRuslan Ermilov.Nm 1529b50d902SRodney W. Grimesto traverse. 1539b50d902SRodney W. GrimesFile hierarchies may also be specified as the operands immediately 1549b50d902SRodney W. Grimesfollowing the options. 1556d0c7e13SWolfram Schneider.It Fl s 1563c94f41fSPhilippe CharnierCause 1578fe908efSRuslan Ermilov.Nm 1586df69548SBruce Evansto traverse the file hierarchies in lexicographical order, 1596df69548SBruce Evansi.e., alphabetical order within each directory. 1606df69548SBruce EvansNote: 161bfd12208SRuslan Ermilov.Ql find -s 1626d0c7e13SWolfram Schneiderand 163bfd12208SRuslan Ermilov.Ql "find | sort" 1646d0c7e13SWolfram Schneidermay give different results. 1659b50d902SRodney W. Grimes.It Fl x 1663c94f41fSPhilippe CharnierPrevent 1678fe908efSRuslan Ermilov.Nm 1689b50d902SRodney W. Grimesfrom descending into directories that have a device number different 1699b50d902SRodney W. Grimesthan that of the file from which the descent began. 17047d91ba3SDag-Erling Smørgrav.Pp 17147d91ba3SDag-Erling SmørgravThis option is equivalent to the deprecated 17247d91ba3SDag-Erling Smørgrav.Ic -xdev 17347d91ba3SDag-Erling Smørgravprimary. 1749b50d902SRodney W. Grimes.El 1759b50d902SRodney W. Grimes.Sh PRIMARIES 176bfd12208SRuslan Ermilov.Bl -tag -width indent 17753e87059STom Rhodes.It Ic -acl 17853e87059STom RhodesMay be used in conjunction with other options to locate 17953e87059STom Rhodesfiles with extended ACLs. 18053e87059STom RhodesSee 18153e87059STom Rhodes.Xr acl 3 18253e87059STom Rhodesfor more information. 1833f5223f8SWolfram Schneider.It Ic -amin Ar n 1843f5223f8SWolfram SchneiderTrue if the difference between the file last access time and the time 1858fe908efSRuslan Ermilov.Nm 18645fe9882SMatthew Huntwas started, rounded up to the next full minute, is 1873f5223f8SWolfram Schneider.Ar n 18845fe9882SMatthew Huntminutes. 189ea92232aSPoul-Henning Kamp.It Ic -anewer Ar file 190ea92232aSPoul-Henning KampSame as 191ea92232aSPoul-Henning Kamp.Ic -neweram . 192adff4fcaSRuslan Ermilov.It Ic -atime Ar n Ns Op Cm smhdw 193adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to 194adff4fcaSRuslan Ermilovtrue if the difference between the file last access time and the time 1958fe908efSRuslan Ermilov.Nm 19654874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is 1979b50d902SRodney W. Grimes.Ar n 19854874bb6SRuslan Ermilov24-hour periods. 199adff4fcaSRuslan Ermilov.Pp 200adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to 201adff4fcaSRuslan Ermilovtrue if the difference between the file last access time and the time 202adff4fcaSRuslan Ermilov.Nm 203adff4fcaSRuslan Ermilovwas started is exactly 204adff4fcaSRuslan Ermilov.Ar n 205adff4fcaSRuslan Ermilovunits. 206adff4fcaSRuslan ErmilovPossible time units are as follows: 207adff4fcaSRuslan Ermilov.Pp 208adff4fcaSRuslan Ermilov.Bl -tag -width indent -compact 209adff4fcaSRuslan Ermilov.It Cm s 210adff4fcaSRuslan Ermilovsecond 211adff4fcaSRuslan Ermilov.It Cm m 212adff4fcaSRuslan Ermilovminute (60 seconds) 213adff4fcaSRuslan Ermilov.It Cm h 214adff4fcaSRuslan Ermilovhour (60 minutes) 215adff4fcaSRuslan Ermilov.It Cm d 216adff4fcaSRuslan Ermilovday (24 hours) 217adff4fcaSRuslan Ermilov.It Cm w 218adff4fcaSRuslan Ermilovweek (7 days) 219adff4fcaSRuslan Ermilov.El 220adff4fcaSRuslan Ermilov.Pp 221adff4fcaSRuslan ErmilovAny number of units may be combined in one 222adff4fcaSRuslan Ermilov.Ic -atime 223adff4fcaSRuslan Ermilovargument, for example, 224adff4fcaSRuslan Ermilov.Dq Li "-atime -1h30m" . 225adff4fcaSRuslan ErmilovUnits are probably only useful when used in conjunction with the 226adff4fcaSRuslan Ermilov.Cm + 227adff4fcaSRuslan Ermilovor 228adff4fcaSRuslan Ermilov.Cm - 229adff4fcaSRuslan Ermilovmodifier. 2303f5223f8SWolfram Schneider.It Ic -cmin Ar n 2313f5223f8SWolfram SchneiderTrue if the difference between the time of last change of file status 2323f5223f8SWolfram Schneiderinformation and the time 2338fe908efSRuslan Ermilov.Nm 23445fe9882SMatthew Huntwas started, rounded up to the next full minute, is 2353f5223f8SWolfram Schneider.Ar n 23645fe9882SMatthew Huntminutes. 237ea92232aSPoul-Henning Kamp.It Ic -cnewer Ar file 238ea92232aSPoul-Henning KampSame as 239ea92232aSPoul-Henning Kamp.Ic -newercm . 240adff4fcaSRuslan Ermilov.It Ic -ctime Ar n Ns Op Cm smhdw 241adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to 242adff4fcaSRuslan Ermilovtrue if the difference between the time of last change of file status 2439b50d902SRodney W. Grimesinformation and the time 2448fe908efSRuslan Ermilov.Nm 24554874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is 2469b50d902SRodney W. Grimes.Ar n 24754874bb6SRuslan Ermilov24-hour periods. 248adff4fcaSRuslan Ermilov.Pp 249adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to 250adff4fcaSRuslan Ermilovtrue if the difference between the time of last change of file status 251adff4fcaSRuslan Ermilovinformation and the time 252adff4fcaSRuslan Ermilov.Nm 253adff4fcaSRuslan Ermilovwas started is exactly 254adff4fcaSRuslan Ermilov.Ar n 255adff4fcaSRuslan Ermilovunits. 256adff4fcaSRuslan ErmilovPlease refer to the 257adff4fcaSRuslan Ermilov.Ic -atime 258adff4fcaSRuslan Ermilovprimary description for information on supported time units. 259abacbbbfSPeter Wemm.It Ic -delete 2606df69548SBruce EvansDelete found files and/or directories. 2616df69548SBruce EvansAlways returns true. 2626df69548SBruce EvansThis executes 263abacbbbfSPeter Wemmfrom the current working directory as 264abacbbbfSPeter Wemm.Nm 2656df69548SBruce Evansrecurses down the tree. 266bfd12208SRuslan ErmilovIt will not attempt to delete a filename with a 267bfd12208SRuslan Ermilov.Dq Pa / 268bfd12208SRuslan Ermilovcharacter in its pathname relative to 269bfd12208SRuslan Ermilov.Dq Pa \&. 270bfd12208SRuslan Ermilovfor security reasons. 27154874bb6SRuslan ErmilovDepth-first traversal processing is implied by this option. 2729b4e871aSDavid E. O'Brien.It Ic -depth 2739b4e871aSDavid E. O'BrienAlways true; 2749b4e871aSDavid E. O'Briensame as the 2759b4e871aSDavid E. O'Brien.Fl d 2769b4e871aSDavid E. O'Brienoption. 2771c832963SOliver Eikemeier.It Ic -depth Ar n 2781c832963SOliver EikemeierTrue if the depth of the file relative to the starting point of the traversal 2791c832963SOliver Eikemeieris 2801c832963SOliver Eikemeier.Ar n . 281ed1a4621SPeter Wemm.It Ic -empty 282ed1a4621SPeter WemmTrue if the current file or directory is empty. 283c93e83feSRuslan Ermilov.It Ic -exec Ar utility Oo Ar argument ... Oc Li \&; 2849b50d902SRodney W. GrimesTrue if the program named 2859b50d902SRodney W. Grimes.Ar utility 2869b50d902SRodney W. Grimesreturns a zero value as its exit status. 287bfd12208SRuslan ErmilovOptional 288bfd12208SRuslan Ermilov.Ar arguments 289bfd12208SRuslan Ermilovmay be passed to the utility. 290bfd12208SRuslan ErmilovThe expression must be terminated by a semicolon 291bfd12208SRuslan Ermilov.Pq Dq Li \&; . 2926a2b59f8SJens SchweikhardtIf you invoke 2936a2b59f8SJens Schweikhardt.Nm 2946a2b59f8SJens Schweikhardtfrom a shell you may need to quote the semicolon if the shell would 2956a2b59f8SJens Schweikhardtotherwise treat it as a control operator. 296bfd12208SRuslan ErmilovIf the string 297bfd12208SRuslan Ermilov.Dq Li {} 298bfd12208SRuslan Ermilovappears anywhere in the utility name or the 2999b50d902SRodney W. Grimesarguments it is replaced by the pathname of the current file. 3009b50d902SRodney W. Grimes.Ar Utility 3019b50d902SRodney W. Grimeswill be executed from the directory from which 3028fe908efSRuslan Ermilov.Nm 3039b50d902SRodney W. Grimeswas executed. 30408274979SYaroslav Tykhiy.Ar Utility 30508274979SYaroslav Tykhiyand 30608274979SYaroslav Tykhiy.Ar arguments 30708274979SYaroslav Tykhiyare not subject to the further expansion of shell patterns 30808274979SYaroslav Tykhiyand constructs. 309c93e83feSRuslan Ermilov.It Ic -exec Ar utility Oo Ar argument ... Oc Li {} + 3105e25d888STim J. RobbinsSame as 3115e25d888STim J. Robbins.Ic -exec , 3125e25d888STim J. Robbinsexcept that 3135e25d888STim J. Robbins.Dq Li {} 3145e25d888STim J. Robbinsis replaced with as many pathnames as possible for each invocation of 3155e25d888STim J. Robbins.Ar utility . 3165e25d888STim J. RobbinsThis behaviour is similar to that of 3175e25d888STim J. Robbins.Xr xargs 1 . 318c93e83feSRuslan Ermilov.It Ic -execdir Ar utility Oo Ar argument ... Oc Li \&; 319127d7563SWarner LoshThe 320bfd12208SRuslan Ermilov.Ic -execdir 321127d7563SWarner Loshprimary is identical to the 322127d7563SWarner Losh.Ic -exec 323127d7563SWarner Loshprimary with the exception that 324bfd12208SRuslan Ermilov.Ar utility 325127d7563SWarner Loshwill be executed from the directory that holds 3266df69548SBruce Evansthe current file. 3276df69548SBruce EvansThe filename substituted for 328bfd12208SRuslan Ermilovthe string 329bfd12208SRuslan Ermilov.Dq Li {} 330bfd12208SRuslan Ermilovis not qualified. 3317fd5ee41SRuslan Ermilov.It Ic -flags Oo Cm - Ns | Ns Cm + Oc Ns Ar flags , Ns Ar notflags 3327fd5ee41SRuslan ErmilovThe flags are specified using symbolic names (see 333208691fcSRuslan Ermilov.Xr chflags 1 ) . 3347fd5ee41SRuslan ErmilovThose with the 3357fd5ee41SRuslan Ermilov.Qq Li no 3367fd5ee41SRuslan Ermilovprefix (except 3377fd5ee41SRuslan Ermilov.Qq Li nodump ) 3387fd5ee41SRuslan Ermilovare said to be 3397fd5ee41SRuslan Ermilov.Ar notflags . 3407fd5ee41SRuslan ErmilovFlags in 3417fd5ee41SRuslan Ermilov.Ar flags 3427fd5ee41SRuslan Ermilovare checked to be set, and flags in 3437fd5ee41SRuslan Ermilov.Ar notflags 3447fd5ee41SRuslan Ermilovare checked to be not set. 345208691fcSRuslan ErmilovNote that this is different from 346208691fcSRuslan Ermilov.Ic -perm , 3477fd5ee41SRuslan Ermilovwhich only allows the user to specify mode bits that are set. 3487fd5ee41SRuslan Ermilov.Pp 3497fd5ee41SRuslan ErmilovIf flags are preceded by a dash 3507fd5ee41SRuslan Ermilov.Pq Dq Li - , 3517fd5ee41SRuslan Ermilovthis primary evaluates to true 3527fd5ee41SRuslan Ermilovif at least all of the bits in 3537fd5ee41SRuslan Ermilov.Ar flags 3547fd5ee41SRuslan Ermilovand none of the bits in 3557fd5ee41SRuslan Ermilov.Ar notflags 3567fd5ee41SRuslan Ermilovare set in the file's flags bits. 3577fd5ee41SRuslan ErmilovIf flags are preceded by a plus 3587fd5ee41SRuslan Ermilov.Pq Dq Li + , 3597fd5ee41SRuslan Ermilovthis primary evaluates to true 3607fd5ee41SRuslan Ermilovif any of the bits in 3617fd5ee41SRuslan Ermilov.Ar flags 3627fd5ee41SRuslan Ermilovis set in the file's flags bits, 3637fd5ee41SRuslan Ermilovor any of the bits in 3647fd5ee41SRuslan Ermilov.Ar notflags 3657fd5ee41SRuslan Ermilovis not set in the file's flags bits. 3667fd5ee41SRuslan ErmilovOtherwise, 3677fd5ee41SRuslan Ermilovthis primary evaluates to true 3687fd5ee41SRuslan Ermilovif the bits in 3697fd5ee41SRuslan Ermilov.Ar flags 3707fd5ee41SRuslan Ermilovexactly match the file's flags bits, 3717fd5ee41SRuslan Ermilovand none of the 3727fd5ee41SRuslan Ermilov.Ar flags 3737fd5ee41SRuslan Ermilovbits match those of 3747fd5ee41SRuslan Ermilov.Ar notflags . 3759b50d902SRodney W. Grimes.It Ic -fstype Ar type 3769b50d902SRodney W. GrimesTrue if the file is contained in a file system of type 3779b50d902SRodney W. Grimes.Ar type . 378841484cdSPeter WemmThe 379841484cdSPeter Wemm.Xr sysctl 8 380841484cdSPeter Wemmcommand can be used to find out the types of file systems 381841484cdSPeter Wemmthat are available on the system: 382bfd12208SRuslan Ermilov.Pp 383bfd12208SRuslan Ermilov.Dl "sysctl vfs" 384bfd12208SRuslan Ermilov.Pp 385bfd12208SRuslan ErmilovIn addition, there are two pseudo-types, 386bfd12208SRuslan Ermilov.Dq Li local 387bfd12208SRuslan Ermilovand 388bfd12208SRuslan Ermilov.Dq Li rdonly . 3899b50d902SRodney W. GrimesThe former matches any file system physically mounted on the system where 3909b50d902SRodney W. Grimesthe 3918fe908efSRuslan Ermilov.Nm 3929b50d902SRodney W. Grimesis being executed and the latter matches any file system which is 3939b50d902SRodney W. Grimesmounted read-only. 3949b50d902SRodney W. Grimes.It Ic -group Ar gname 3959b50d902SRodney W. GrimesTrue if the file belongs to the group 3969b50d902SRodney W. Grimes.Ar gname . 3979b50d902SRodney W. GrimesIf 3989b50d902SRodney W. Grimes.Ar gname 3999b50d902SRodney W. Grimesis numeric and there is no such group name, then 4009b50d902SRodney W. Grimes.Ar gname 401bfd12208SRuslan Ermilovis treated as a group ID. 402208691fcSRuslan Ermilov.It Ic -iname Ar pattern 403208691fcSRuslan ErmilovLike 404208691fcSRuslan Ermilov.Ic -name , 405208691fcSRuslan Ermilovbut the match is case insensitive. 4069b50d902SRodney W. Grimes.It Ic -inum Ar n 4079b50d902SRodney W. GrimesTrue if the file has inode number 4089b50d902SRodney W. Grimes.Ar n . 409208691fcSRuslan Ermilov.It Ic -ipath Ar pattern 410208691fcSRuslan ErmilovLike 411208691fcSRuslan Ermilov.Ic -path , 412208691fcSRuslan Ermilovbut the match is case insensitive. 413208691fcSRuslan Ermilov.It Ic -iregex Ar pattern 414208691fcSRuslan ErmilovLike 415208691fcSRuslan Ermilov.Ic -regex , 416208691fcSRuslan Ermilovbut the match is case insensitive. 4179b50d902SRodney W. Grimes.It Ic -links Ar n 4189b50d902SRodney W. GrimesTrue if the file has 4199b50d902SRodney W. Grimes.Ar n 4209b50d902SRodney W. Grimeslinks. 4219b50d902SRodney W. Grimes.It Ic -ls 4229b50d902SRodney W. GrimesThis primary always evaluates to true. 4239b50d902SRodney W. GrimesThe following information for the current file is written to standard output: 42454874bb6SRuslan Ermilovits inode number, size in 512-byte blocks, file permissions, number of hard 4259b50d902SRodney W. Grimeslinks, owner, group, size in bytes, last modification time, and pathname. 4269b50d902SRodney W. GrimesIf the file is a block or character special file, the major and minor numbers 4279b50d902SRodney W. Grimeswill be displayed instead of the size in bytes. 42854874bb6SRuslan ErmilovIf the file is a symbolic link, the pathname of the linked-to file will be 429bfd12208SRuslan Ermilovdisplayed preceded by 430bfd12208SRuslan Ermilov.Dq Li -> . 431bfd12208SRuslan ErmilovThe format is identical to that produced by 432bfd12208SRuslan Ermilov.Bk -words 433bfd12208SRuslan Ermilov.Nm ls Fl dgils . 434bfd12208SRuslan Ermilov.Ek 435c76bc8f3SOllivier Robert.It Ic -maxdepth Ar n 4369c61111dSOliver EikemeierAlways true; descend at most 4379c61111dSOliver Eikemeier.Ar n 4389c61111dSOliver Eikemeierdirectory levels below the command line arguments. 439d79829afSOliver EikemeierIf any 440d79829afSOliver Eikemeier.Ic -maxdepth 441d79829afSOliver Eikemeierprimary is specified, it applies to the entire expression even if it would 442d79829afSOliver Eikemeiernot normally be evaluated. 443d79829afSOliver Eikemeier.Ic -maxdepth Li 0 444d79829afSOliver Eikemeierlimits the whole search to the command line arguments. 445c76bc8f3SOllivier Robert.It Ic -mindepth Ar n 4469c61111dSOliver EikemeierAlways true; do not apply any tests or actions at levels less than 4479c61111dSOliver Eikemeier.Ar n . 448d79829afSOliver EikemeierIf any 449d79829afSOliver Eikemeier.Ic -mindepth 450d79829afSOliver Eikemeierprimary is specified, it applies to the entire expression even if it would 451d79829afSOliver Eikemeiernot normally be evaluated. 452d79829afSOliver Eikemeier.Ic -mindepth Li 1 453d79829afSOliver Eikemeierprocesses all but the command line arguments. 4543f5223f8SWolfram Schneider.It Ic -mmin Ar n 4553f5223f8SWolfram SchneiderTrue if the difference between the file last modification time and the time 4568fe908efSRuslan Ermilov.Nm 45745fe9882SMatthew Huntwas started, rounded up to the next full minute, is 4583f5223f8SWolfram Schneider.Ar n 45945fe9882SMatthew Huntminutes. 460208691fcSRuslan Ermilov.It Ic -mnewer Ar file 461208691fcSRuslan ErmilovSame as 462208691fcSRuslan Ermilov.Ic -newer . 463adff4fcaSRuslan Ermilov.It Ic -mtime Ar n Ns Op Cm smhdw 464adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to 465adff4fcaSRuslan Ermilovtrue if the difference between the file last modification time and the time 4668fe908efSRuslan Ermilov.Nm 46754874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is 4689b50d902SRodney W. Grimes.Ar n 46954874bb6SRuslan Ermilov24-hour periods. 470adff4fcaSRuslan Ermilov.Pp 471adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to 472adff4fcaSRuslan Ermilovtrue if the difference between the file last modification time and the time 473adff4fcaSRuslan Ermilov.Nm 474adff4fcaSRuslan Ermilovwas started is exactly 475adff4fcaSRuslan Ermilov.Ar n 476adff4fcaSRuslan Ermilovunits. 477adff4fcaSRuslan ErmilovPlease refer to the 478adff4fcaSRuslan Ermilov.Ic -atime 479adff4fcaSRuslan Ermilovprimary description for information on supported time units. 4809b50d902SRodney W. Grimes.It Ic -name Ar pattern 4819b50d902SRodney W. GrimesTrue if the last component of the pathname being examined matches 4829b50d902SRodney W. Grimes.Ar pattern . 483bfd12208SRuslan ErmilovSpecial shell pattern matching characters 484bfd12208SRuslan Ermilov.Dq ( Li \&[ , 485bfd12208SRuslan Ermilov.Dq Li \&] , 486bfd12208SRuslan Ermilov.Dq Li * , 487bfd12208SRuslan Ermilovand 488bfd12208SRuslan Ermilov.Dq Li \&? ) 4899b50d902SRodney W. Grimesmay be used as part of 4909b50d902SRodney W. Grimes.Ar pattern . 4919b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a 492bfd12208SRuslan Ermilovbackslash 493bfd12208SRuslan Ermilov.Pq Dq Li \e . 4949b50d902SRodney W. Grimes.It Ic -newer Ar file 4959b50d902SRodney W. GrimesTrue if the current file has a more recent last modification time than 4969b50d902SRodney W. Grimes.Ar file . 497bfd12208SRuslan Ermilov.It Ic -newer Ns Ar X Ns Ar Y Ar file 498bfd12208SRuslan ErmilovTrue if the current file has a more recent last access time 499bfd12208SRuslan Ermilov.Ar ( X Ns = Ns Cm a ) , 500bfd12208SRuslan Ermilovchange time 501bfd12208SRuslan Ermilov.Ar ( X Ns = Ns Cm c ) , 502bfd12208SRuslan Ermilovor modification time 503bfd12208SRuslan Ermilov.Ar ( X Ns = Ns Cm m ) 504bfd12208SRuslan Ermilovthan the last access time 505bfd12208SRuslan Ermilov.Ar ( Y Ns = Ns Cm a ) , 506bfd12208SRuslan Ermilovchange time 507bfd12208SRuslan Ermilov.Ar ( Y Ns = Ns Cm c ) , 508bfd12208SRuslan Ermilovor modification time 509bfd12208SRuslan Ermilov.Ar ( Y Ns = Ns Cm m ) 510bfd12208SRuslan Ermilovof 511ea92232aSPoul-Henning Kamp.Ar file . 512ea92232aSPoul-Henning KampIn addition, if 513bfd12208SRuslan Ermilov.Ar Y Ns = Ns Cm t , 514ea92232aSPoul-Henning Kampthen 515ea92232aSPoul-Henning Kamp.Ar file 516ea92232aSPoul-Henning Kampis instead interpreted as a direct date specification of the form 517ea92232aSPoul-Henning Kampunderstood by 518ea92232aSPoul-Henning Kamp.Xr cvs 1 . 519ea92232aSPoul-Henning KampNote that 520ea92232aSPoul-Henning Kamp.Ic -newermm 521ea92232aSPoul-Henning Kampis equivalent to 522ea92232aSPoul-Henning Kamp.Ic -newer . 5239b50d902SRodney W. Grimes.It Ic -nogroup 5249b50d902SRodney W. GrimesTrue if the file belongs to an unknown group. 525208691fcSRuslan Ermilov.It Ic -nouser 526208691fcSRuslan ErmilovTrue if the file belongs to an unknown user. 527c93e83feSRuslan Ermilov.It Ic -ok Ar utility Oo Ar argument ... Oc Li \&; 528208691fcSRuslan ErmilovThe 529208691fcSRuslan Ermilov.Ic -ok 530208691fcSRuslan Ermilovprimary is identical to the 531208691fcSRuslan Ermilov.Ic -exec 532208691fcSRuslan Ermilovprimary with the exception that 533208691fcSRuslan Ermilov.Nm 534208691fcSRuslan Ermilovrequests user affirmation for the execution of the 535208691fcSRuslan Ermilov.Ar utility 536208691fcSRuslan Ermilovby printing 537208691fcSRuslan Ermilova message to the terminal and reading a response. 53839c59153SRuslan ErmilovIf the response is not affirmative 53939c59153SRuslan Ermilov.Ql ( y 540ef6c7764STim J. Robbinsin the 541ef6c7764STim J. Robbins.Dq Li POSIX 542ef6c7764STim J. Robbinslocale), 543208691fcSRuslan Ermilovthe command is not executed and the 544208691fcSRuslan Ermilovvalue of the 545208691fcSRuslan Ermilov.Ic -ok 546208691fcSRuslan Ermilovexpression is false. 547c93e83feSRuslan Ermilov.It Ic -okdir Ar utility Oo Ar argument ... Oc Li \&; 548208691fcSRuslan ErmilovThe 549208691fcSRuslan Ermilov.Ic -okdir 550208691fcSRuslan Ermilovprimary is identical to the 551208691fcSRuslan Ermilov.Ic -execdir 552208691fcSRuslan Ermilovprimary with the same exception as described for the 553208691fcSRuslan Ermilov.Ic -ok 554208691fcSRuslan Ermilovprimary. 5559b50d902SRodney W. Grimes.It Ic -path Ar pattern 5569b50d902SRodney W. GrimesTrue if the pathname being examined matches 5579b50d902SRodney W. Grimes.Ar pattern . 558bfd12208SRuslan ErmilovSpecial shell pattern matching characters 559bfd12208SRuslan Ermilov.Dq ( Li \&[ , 560bfd12208SRuslan Ermilov.Dq Li \&] , 561bfd12208SRuslan Ermilov.Dq Li * , 562bfd12208SRuslan Ermilovand 563bfd12208SRuslan Ermilov.Dq Li \&? ) 5649b50d902SRodney W. Grimesmay be used as part of 5659b50d902SRodney W. Grimes.Ar pattern . 5669b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a 567bfd12208SRuslan Ermilovbackslash 568bfd12208SRuslan Ermilov.Pq Dq Li \e . 569bfd12208SRuslan ErmilovSlashes 570bfd12208SRuslan Ermilov.Pq Dq Li / 571bfd12208SRuslan Ermilovare treated as normal characters and do not have to be 5729b50d902SRodney W. Grimesmatched explicitly. 5737fd5ee41SRuslan Ermilov.It Ic -perm Oo Cm - Ns | Ns Cm + Oc Ns Ar mode 5749b50d902SRodney W. GrimesThe 5759b50d902SRodney W. Grimes.Ar mode 5769b50d902SRodney W. Grimesmay be either symbolic (see 5779b50d902SRodney W. Grimes.Xr chmod 1 ) 5789b50d902SRodney W. Grimesor an octal number. 5797fd5ee41SRuslan ErmilovIf the 5807fd5ee41SRuslan Ermilov.Ar mode 5817fd5ee41SRuslan Ermilovis symbolic, a starting value of zero is assumed and the 5827fd5ee41SRuslan Ermilov.Ar mode 5837fd5ee41SRuslan Ermilovsets or clears permissions without regard to the process' file mode 5849b50d902SRodney W. Grimescreation mask. 5857fd5ee41SRuslan ErmilovIf the 5867fd5ee41SRuslan Ermilov.Ar mode 5877fd5ee41SRuslan Ermilovis octal, only bits 07777 588bfd12208SRuslan Ermilov.Pq Dv S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO 5899b50d902SRodney W. Grimesof the file's mode bits participate 5909b50d902SRodney W. Grimesin the comparison. 5917fd5ee41SRuslan ErmilovIf the 5927fd5ee41SRuslan Ermilov.Ar mode 5937fd5ee41SRuslan Ermilovis preceded by a dash 594bfd12208SRuslan Ermilov.Pq Dq Li - , 5959b88faecSRuslan Ermilovthis primary evaluates to true 5967fd5ee41SRuslan Ermilovif at least all of the bits in the 5977fd5ee41SRuslan Ermilov.Ar mode 5987fd5ee41SRuslan Ermilovare set in the file's mode bits. 5997fd5ee41SRuslan ErmilovIf the 6007fd5ee41SRuslan Ermilov.Ar mode 6017fd5ee41SRuslan Ermilovis preceded by a plus 602bfd12208SRuslan Ermilov.Pq Dq Li + , 6039b88faecSRuslan Ermilovthis primary evaluates to true 6047fd5ee41SRuslan Ermilovif any of the bits in the 6057fd5ee41SRuslan Ermilov.Ar mode 6067fd5ee41SRuslan Ermilovare set in the file's mode bits. 6079d2796c3SOllivier RobertOtherwise, this primary evaluates to true if 6087fd5ee41SRuslan Ermilovthe bits in the 6097fd5ee41SRuslan Ermilov.Ar mode 6107fd5ee41SRuslan Ermilovexactly match the file's mode bits. 611bfd12208SRuslan ErmilovNote, the first character of a symbolic mode may not be a dash 612bfd12208SRuslan Ermilov.Pq Dq Li - . 6139b50d902SRodney W. Grimes.It Ic -print 6149b50d902SRodney W. GrimesThis primary always evaluates to true. 6159b50d902SRodney W. GrimesIt prints the pathname of the current file to standard output. 616841484cdSPeter WemmIf none of 617bfd12208SRuslan Ermilov.Ic -exec , -ls , -print0 , 6189b50d902SRodney W. Grimesor 619bfd12208SRuslan Ermilov.Ic -ok 620841484cdSPeter Wemmis specified, the given expression shall be effectively replaced by 621bfd12208SRuslan Ermilov.Cm \&( Ar "given expression" Cm \&) Ic -print . 6227cd23434SGarrett Wollman.It Ic -print0 6237cd23434SGarrett WollmanThis primary always evaluates to true. 624fbe0d04aSMasafumi Max NAKANEIt prints the pathname of the current file to standard output, followed by an 625bfd12208SRuslan Ermilov.Tn ASCII NUL 6267cd23434SGarrett Wollmancharacter (character code 0). 6279b50d902SRodney W. Grimes.It Ic -prune 6289b50d902SRodney W. GrimesThis primary always evaluates to true. 6299b50d902SRodney W. GrimesIt causes 6308fe908efSRuslan Ermilov.Nm 6319b50d902SRodney W. Grimesto not descend into the current file. 6329b50d902SRodney W. GrimesNote, the 6339b50d902SRodney W. Grimes.Ic -prune 6349b50d902SRodney W. Grimesprimary has no effect if the 6359b50d902SRodney W. Grimes.Fl d 6369b50d902SRodney W. Grimesoption was specified. 637208691fcSRuslan Ermilov.It Ic -regex Ar pattern 638208691fcSRuslan ErmilovTrue if the whole path of the file matches 639208691fcSRuslan Ermilov.Ar pattern 640208691fcSRuslan Ermilovusing regular expression. 641208691fcSRuslan ErmilovTo match a file named 642208691fcSRuslan Ermilov.Dq Pa ./foo/xyzzy , 643208691fcSRuslan Ermilovyou can use the regular expression 644208691fcSRuslan Ermilov.Dq Li ".*/[xyz]*" 645208691fcSRuslan Ermilovor 646208691fcSRuslan Ermilov.Dq Li ".*/foo/.*" , 647208691fcSRuslan Ermilovbut not 648208691fcSRuslan Ermilov.Dq Li xyzzy 649208691fcSRuslan Ermilovor 650208691fcSRuslan Ermilov.Dq Li /foo/ . 6519b50d902SRodney W. Grimes.It Ic -size Ar n Ns Op Cm c 65254874bb6SRuslan ErmilovTrue if the file's size, rounded up, in 512-byte blocks is 6539b50d902SRodney W. Grimes.Ar n . 6549b50d902SRodney W. GrimesIf 6559b50d902SRodney W. Grimes.Ar n 656bfd12208SRuslan Ermilovis followed by a 657bfd12208SRuslan Ermilov.Cm c , 658bfd12208SRuslan Ermilovthen the primary is true if the 6599b50d902SRodney W. Grimesfile's size is 6609b50d902SRodney W. Grimes.Ar n 661bfd12208SRuslan Ermilovbytes (characters). 6629b50d902SRodney W. Grimes.It Ic -type Ar t 6639b50d902SRodney W. GrimesTrue if the file is of the specified type. 6649b50d902SRodney W. GrimesPossible file types are as follows: 6659b50d902SRodney W. Grimes.Pp 666bfd12208SRuslan Ermilov.Bl -tag -width indent -compact 6679b50d902SRodney W. Grimes.It Cm b 6689b50d902SRodney W. Grimesblock special 6699b50d902SRodney W. Grimes.It Cm c 6709b50d902SRodney W. Grimescharacter special 6719b50d902SRodney W. Grimes.It Cm d 6729b50d902SRodney W. Grimesdirectory 6739b50d902SRodney W. Grimes.It Cm f 6749b50d902SRodney W. Grimesregular file 6759b50d902SRodney W. Grimes.It Cm l 6769b50d902SRodney W. Grimessymbolic link 6779b50d902SRodney W. Grimes.It Cm p 6789b50d902SRodney W. GrimesFIFO 6799b50d902SRodney W. Grimes.It Cm s 6809b50d902SRodney W. Grimessocket 6819b50d902SRodney W. Grimes.El 6829b50d902SRodney W. Grimes.It Ic -user Ar uname 6839b50d902SRodney W. GrimesTrue if the file belongs to the user 6849b50d902SRodney W. Grimes.Ar uname . 6859b50d902SRodney W. GrimesIf 6869b50d902SRodney W. Grimes.Ar uname 6879b50d902SRodney W. Grimesis numeric and there is no such user name, then 6889b50d902SRodney W. Grimes.Ar uname 689bfd12208SRuslan Ermilovis treated as a user ID. 6909b50d902SRodney W. Grimes.El 6919b50d902SRodney W. Grimes.Pp 6929b50d902SRodney W. GrimesAll primaries which take a numeric argument allow the number to be 6939b88faecSRuslan Ermilovpreceded by a plus sign 694bfd12208SRuslan Ermilov.Pq Dq Li + 6959b88faecSRuslan Ermilovor a minus sign 696bfd12208SRuslan Ermilov.Pq Dq Li - . 697bfd12208SRuslan ErmilovA preceding plus sign means 698bfd12208SRuslan Ermilov.Dq more than n , 699bfd12208SRuslan Ermilova preceding minus sign means 700bfd12208SRuslan Ermilov.Dq less than n 701bfd12208SRuslan Ermilovand neither means 702bfd12208SRuslan Ermilov.Dq exactly n . 7039b50d902SRodney W. Grimes.Sh OPERATORS 7049b50d902SRodney W. GrimesThe primaries may be combined using the following operators. 7059b50d902SRodney W. GrimesThe operators are listed in order of decreasing precedence. 706bfd12208SRuslan Ermilov.Pp 707bfd12208SRuslan Ermilov.Bl -tag -width "( expression )" -compact 7080c101fb2SJoseph Koshy.It Cm \&( Ar expression Cm \&) 7099b50d902SRodney W. GrimesThis evaluates to true if the parenthesized expression evaluates to 7109b50d902SRodney W. Grimestrue. 7119b50d902SRodney W. Grimes.Pp 7120c101fb2SJoseph Koshy.It Cm \&! Ar expression 713c9776a93SJuli Mallett.It Cm -false Ar expression 7144a0193d3SJuli Mallett.It Cm -not Ar expression 7159b50d902SRodney W. GrimesThis is the unary 7169b50d902SRodney W. Grimes.Tn NOT 7179b50d902SRodney W. Grimesoperator. 7189b50d902SRodney W. GrimesIt evaluates to true if the expression is false. 7199b50d902SRodney W. Grimes.Pp 7209b50d902SRodney W. Grimes.It Ar expression Cm -and Ar expression 7219b50d902SRodney W. Grimes.It Ar expression expression 7229b50d902SRodney W. GrimesThe 7239b50d902SRodney W. Grimes.Cm -and 7249b50d902SRodney W. Grimesoperator is the logical 7259b50d902SRodney W. Grimes.Tn AND 7269b50d902SRodney W. Grimesoperator. 7279b50d902SRodney W. GrimesAs it is implied by the juxtaposition of two expressions it does not 7289b50d902SRodney W. Grimeshave to be specified. 7299b50d902SRodney W. GrimesThe expression evaluates to true if both expressions are true. 7309b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is false. 7319b50d902SRodney W. Grimes.Pp 7329b50d902SRodney W. Grimes.It Ar expression Cm -or Ar expression 7339b50d902SRodney W. GrimesThe 7349b50d902SRodney W. Grimes.Cm -or 7359b50d902SRodney W. Grimesoperator is the logical 7369b50d902SRodney W. Grimes.Tn OR 7379b50d902SRodney W. Grimesoperator. 7389b50d902SRodney W. GrimesThe expression evaluates to true if either the first or the second expression 7399b50d902SRodney W. Grimesis true. 7409b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is true. 7419b50d902SRodney W. Grimes.El 7429b50d902SRodney W. Grimes.Pp 7439b50d902SRodney W. GrimesAll operands and primaries must be separate arguments to 7448fe908efSRuslan Ermilov.Nm . 7459b50d902SRodney W. GrimesPrimaries which themselves take arguments expect each argument 7469b50d902SRodney W. Grimesto be a separate argument to 7478fe908efSRuslan Ermilov.Nm . 748ef6c7764STim J. Robbins.Sh ENVIRONMENT 749ef6c7764STim J. RobbinsThe 750ef6c7764STim J. Robbins.Ev LANG , LC_ALL , LC_COLLATE , LC_CTYPE , LC_MESSAGES 751ef6c7764STim J. Robbinsand 752ef6c7764STim J. Robbins.Ev LC_TIME 753ef6c7764STim J. Robbinsenvironment variables affect the execution of the 754ef6c7764STim J. Robbins.Nm 755ef6c7764STim J. Robbinsutility as described in 756ef6c7764STim J. Robbins.Xr environ 7 . 7579b50d902SRodney W. Grimes.Sh EXAMPLES 7589b50d902SRodney W. GrimesThe following examples are shown as given to the shell: 759bfd12208SRuslan Ermilov.Bl -tag -width indent 7609b50d902SRodney W. Grimes.It Li "find / \e! -name \*q*.c\*q -print" 761bfd12208SRuslan ErmilovPrint out a list of all the files whose names do not end in 762bfd12208SRuslan Ermilov.Pa .c . 7639b50d902SRodney W. Grimes.It Li "find / -newer ttt -user wnj -print" 764bfd12208SRuslan ErmilovPrint out a list of all the files owned by user 765bfd12208SRuslan Ermilov.Dq wnj 766bfd12208SRuslan Ermilovthat are newer 767bfd12208SRuslan Ermilovthan the file 768bfd12208SRuslan Ermilov.Pa ttt . 7699b50d902SRodney W. Grimes.It Li "find / \e! \e( -newer ttt -user wnj \e) -print" 770bfd12208SRuslan ErmilovPrint out a list of all the files which are not both newer than 771bfd12208SRuslan Ermilov.Pa ttt 772bfd12208SRuslan Ermilovand owned by 773bfd12208SRuslan Ermilov.Dq wnj . 7749b50d902SRodney W. Grimes.It Li "find / \e( -newer ttt -or -user wnj \e) -print" 775bfd12208SRuslan ErmilovPrint out a list of all the files that are either owned by 776bfd12208SRuslan Ermilov.Dq wnj 777bfd12208SRuslan Ermilovor that are newer than 778bfd12208SRuslan Ermilov.Pa ttt . 779e578c242STom Rhodes.It Li "find / -newerct '1 minute ago' -print" 780ea92232aSPoul-Henning KampPrint out a list of all the files whose inode change time is more 781ea92232aSPoul-Henning Kamprecent than the current time minus one minute. 78254874bb6SRuslan Ermilov.It Li "find / -type f -exec echo {} \e;" 783e578c242STom RhodesUse the 784e578c242STom Rhodes.Xr echo 1 785e578c242STom Rhodescommand to print out a list of all the files. 7861c832963SOliver Eikemeier.It Li "find -L /usr/ports/packages -type l -delete" 7871c832963SOliver EikemeierDelete all broken symbolic links in 7881c832963SOliver Eikemeier.Pa /usr/ports/packages . 7891c832963SOliver Eikemeier.It Li "find /usr/src -name CVS -prune -o -depth +6 -print" 7901c832963SOliver EikemeierFind files and directories that are at least seven levels deep 7911c832963SOliver Eikemeierin the working directory 7921c832963SOliver Eikemeier.Pa /usr/src . 7931c832963SOliver Eikemeier.It Li "find /usr/src -name CVS -prune -o -mindepth 7 -print" 7941c832963SOliver EikemeierIs not equivalent to the previous example, since 7951c832963SOliver Eikemeier.Ic -prune 7961c832963SOliver Eikemeieris not evaluated below level seven. 7979b50d902SRodney W. Grimes.El 798e578c242STom Rhodes.Sh COMPATIBILITY 799e578c242STom RhodesThe 800e578c242STom Rhodes.Ic -follow 80147d91ba3SDag-Erling Smørgravprimary is deprecated; the 80247d91ba3SDag-Erling Smørgrav.Fl L 80347d91ba3SDag-Erling Smørgravoption should be used instead. 80447d91ba3SDag-Erling SmørgravSee the 80547d91ba3SDag-Erling Smørgrav.Sx STANDARDS 80647d91ba3SDag-Erling Smørgravsection below for details. 8079b50d902SRodney W. Grimes.Sh SEE ALSO 808567664c4SOllivier Robert.Xr chflags 1 , 8099b50d902SRodney W. Grimes.Xr chmod 1 , 810ea92232aSPoul-Henning Kamp.Xr cvs 1 , 8119b50d902SRodney W. Grimes.Xr locate 1 , 81241cbb624SJoseph Koshy.Xr whereis 1 , 81341cbb624SJoseph Koshy.Xr which 1 , 814a8d50686STom Rhodes.Xr xargs 1 , 8159b50d902SRodney W. Grimes.Xr stat 2 , 81653e87059STom Rhodes.Xr acl 3 , 8179b50d902SRodney W. Grimes.Xr fts 3 , 8189b50d902SRodney W. Grimes.Xr getgrent 3 , 8199b50d902SRodney W. Grimes.Xr getpwent 3 , 8209b50d902SRodney W. Grimes.Xr strmode 3 , 82194ad6032SRuslan Ermilov.Xr re_format 7 , 8229b50d902SRodney W. Grimes.Xr symlink 7 8239b50d902SRodney W. Grimes.Sh STANDARDS 8249b50d902SRodney W. GrimesThe 8258fe908efSRuslan Ermilov.Nm 8269b50d902SRodney W. Grimesutility syntax is a superset of the syntax specified by the 8271c832963SOliver Eikemeier.St -p1003.1-2001 8289b50d902SRodney W. Grimesstandard. 8299b50d902SRodney W. Grimes.Pp 8301c832963SOliver EikemeierAll the single character options except 8311c832963SOliver Eikemeier.Ic -H 8321c832963SOliver Eikemeierand 8331c832963SOliver Eikemeier.Ic -L 8341c832963SOliver Eikemeieras well as the 835bfd12208SRuslan Ermilov.Ic -iname , -inum , -iregex , -print0 , -delete , -ls , 836f6e4fb22SSteve Priceand 8377c1d4b3aSAkinori MUSHA.Ic -regex 838f6e4fb22SSteve Priceprimaries are extensions to 8391c832963SOliver Eikemeier.St -p1003.1-2001 . 840f6e4fb22SSteve Price.Pp 8419b50d902SRodney W. GrimesHistorically, the 84247d91ba3SDag-Erling Smørgrav.Fl d , L 8439b50d902SRodney W. Grimesand 8449b50d902SRodney W. Grimes.Fl x 845bfd12208SRuslan Ermilovoptions were implemented using the primaries 846bfd12208SRuslan Ermilov.Ic -depth , -follow , 847bfd12208SRuslan Ermilovand 848bfd12208SRuslan Ermilov.Ic -xdev . 8499b50d902SRodney W. GrimesThese primaries always evaluated to true. 8509b50d902SRodney W. GrimesAs they were really global variables that took effect before the traversal 8519b50d902SRodney W. Grimesbegan, some legal expressions could have unexpected results. 852bfd12208SRuslan ErmilovAn example is the expression 853bfd12208SRuslan Ermilov.Ic -print Cm -o Ic -depth . 854bfd12208SRuslan ErmilovAs 855bfd12208SRuslan Ermilov.Ic -print 856bfd12208SRuslan Ermilovalways evaluates to true, the standard order of evaluation 857bfd12208SRuslan Ermilovimplies that 858bfd12208SRuslan Ermilov.Ic -depth 859bfd12208SRuslan Ermilovwould never be evaluated. 8609b50d902SRodney W. GrimesThis is not the case. 8619b50d902SRodney W. Grimes.Pp 862bfd12208SRuslan ErmilovThe operator 863bfd12208SRuslan Ermilov.Cm -or 864bfd12208SRuslan Ermilovwas implemented as 865bfd12208SRuslan Ermilov.Cm -o , 866bfd12208SRuslan Ermilovand the operator 867bfd12208SRuslan Ermilov.Cm -and 868bfd12208SRuslan Ermilovwas implemented as 869bfd12208SRuslan Ermilov.Cm -a . 8709b50d902SRodney W. Grimes.Pp 8719b50d902SRodney W. GrimesHistoric implementations of the 872bfd12208SRuslan Ermilov.Ic -exec 8739b50d902SRodney W. Grimesand 874bfd12208SRuslan Ermilov.Ic -ok 875bfd12208SRuslan Ermilovprimaries did not replace the string 876bfd12208SRuslan Ermilov.Dq Li {} 877bfd12208SRuslan Ermilovin the utility name or the 8789b50d902SRodney W. Grimesutility arguments if it had preceding or following non-whitespace characters. 8799b50d902SRodney W. GrimesThis version replaces it no matter where in the utility name or arguments 8809b50d902SRodney W. Grimesit appears. 8817c1d4b3aSAkinori MUSHA.Pp 8827c1d4b3aSAkinori MUSHAThe 8837c1d4b3aSAkinori MUSHA.Fl E 88447d91ba3SDag-Erling Smørgravoption was inspired by the equivalent 8857c1d4b3aSAkinori MUSHA.Xr grep 1 8867c1d4b3aSAkinori MUSHAand 88747d91ba3SDag-Erling Smørgrav.Xr sed 1 88847d91ba3SDag-Erling Smørgravoptions. 889ad487600SColin Percival.Sh HISTORY 890ad487600SColin PercivalA 891ad487600SColin Percival.Nm 892ad487600SColin Percivalcommand appeared in 893ad487600SColin Percival.At v1 . 8949b50d902SRodney W. Grimes.Sh BUGS 8959b50d902SRodney W. GrimesThe special characters used by 8968fe908efSRuslan Ermilov.Nm 8979b50d902SRodney W. Grimesare also special characters to many shell programs. 898bfd12208SRuslan ErmilovIn particular, the characters 899bfd12208SRuslan Ermilov.Dq Li * , 900bfd12208SRuslan Ermilov.Dq Li \&[ , 901bfd12208SRuslan Ermilov.Dq Li \&] , 902bfd12208SRuslan Ermilov.Dq Li \&? , 903bfd12208SRuslan Ermilov.Dq Li \&( , 904bfd12208SRuslan Ermilov.Dq Li \&) , 905bfd12208SRuslan Ermilov.Dq Li \&! , 906bfd12208SRuslan Ermilov.Dq Li \e 907bfd12208SRuslan Ermilovand 908bfd12208SRuslan Ermilov.Dq Li \&; 909bfd12208SRuslan Ermilovmay have to be escaped from the shell. 9109b50d902SRodney W. Grimes.Pp 9119b50d902SRodney W. GrimesAs there is no delimiter separating options and file names or file 9129b50d902SRodney W. Grimesnames and the 9139b50d902SRodney W. Grimes.Ar expression , 914bfd12208SRuslan Ermilovit is difficult to specify files named 915bfd12208SRuslan Ermilov.Pa -xdev 916bfd12208SRuslan Ermilovor 917bfd12208SRuslan Ermilov.Pa \&! . 9189b50d902SRodney W. GrimesThese problems are handled by the 9199b50d902SRodney W. Grimes.Fl f 9209b50d902SRodney W. Grimesoption and the 9219b50d902SRodney W. Grimes.Xr getopt 3 922bfd12208SRuslan Ermilov.Dq Fl Fl 923bfd12208SRuslan Ermilovconstruct. 924abacbbbfSPeter Wemm.Pp 925abacbbbfSPeter WemmThe 926abacbbbfSPeter Wemm.Ic -delete 92756f7a840SBill Fumerolaprimary does not interact well with other options that cause the file system 928abacbbbfSPeter Wemmtree traversal options to be changed. 929ad487600SColin Percival.Pp 9304f45d811STim J. RobbinsThe 931dfef91e9SColin Percival.Ic -mindepth 932dfef91e9SColin Percivaland 933dfef91e9SColin Percival.Ic -maxdepth 9342cb640f6SColin Percivalprimaries are actually global options (as documented above). 9352cb640f6SColin PercivalThey should 936dfef91e9SColin Percivalprobably be replaced by options which look like options. 937