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.\" 4. Neither the name of the University nor the names of its contributors 169b50d902SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 179b50d902SRodney W. Grimes.\" without specific prior written permission. 189b50d902SRodney W. Grimes.\" 199b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 209b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 219b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 229b50d902SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 239b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 249b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 259b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 269b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 279b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 289b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 299b50d902SRodney W. Grimes.\" SUCH DAMAGE. 309b50d902SRodney W. Grimes.\" 31841484cdSPeter Wemm.\" @(#)find.1 8.7 (Berkeley) 5/9/95 32c3aac50fSPeter Wemm.\" $FreeBSD$ 339b50d902SRodney W. Grimes.\" 34d740b7c7SPawel Jakub Dawidek.Dd March 17, 2010 359b50d902SRodney W. Grimes.Dt FIND 1 369b50d902SRodney W. Grimes.Os 379b50d902SRodney W. Grimes.Sh NAME 389b50d902SRodney W. Grimes.Nm find 399b50d902SRodney W. Grimes.Nd walk a file hierarchy 409b50d902SRodney W. Grimes.Sh SYNOPSIS 418fe908efSRuslan Ermilov.Nm 429b50d902SRodney W. Grimes.Op Fl H | Fl L | Fl P 437c1d4b3aSAkinori MUSHA.Op Fl EXdsx 44dfab7fb1SRuslan Ermilov.Op Fl f Ar path 45dfab7fb1SRuslan Ermilov.Ar path ... 46dfab7fb1SRuslan Ermilov.Op Ar expression 47107f86a2SStefan Farfeleder.Nm 48107f86a2SStefan Farfeleder.Op Fl H | Fl L | Fl P 49107f86a2SStefan Farfeleder.Op Fl EXdsx 50dfab7fb1SRuslan Ermilov.Fl f Ar path 51dfab7fb1SRuslan Ermilov.Op Ar path ... 52dfab7fb1SRuslan Ermilov.Op Ar expression 539b50d902SRodney W. Grimes.Sh DESCRIPTION 54e8937ba0SPhilippe CharnierThe 55e8937ba0SPhilippe Charnier.Nm 56e8937ba0SPhilippe Charnierutility recursively descends the directory tree for each 57dfab7fb1SRuslan Ermilov.Ar path 589b50d902SRodney W. Grimeslisted, evaluating an 599b50d902SRodney W. Grimes.Ar expression 60bfd12208SRuslan Ermilov(composed of the 61bfd12208SRuslan Ermilov.Dq primaries 62bfd12208SRuslan Ermilovand 63bfd12208SRuslan Ermilov.Dq operands 64bfd12208SRuslan Ermilovlisted below) in terms 659b50d902SRodney W. Grimesof each file in the tree. 669b50d902SRodney W. Grimes.Pp 679b50d902SRodney W. GrimesThe options are as follows: 68bfd12208SRuslan Ermilov.Bl -tag -width indent 697c1d4b3aSAkinori MUSHA.It Fl E 707c1d4b3aSAkinori MUSHAInterpret regular expressions followed by 717c1d4b3aSAkinori MUSHA.Ic -regex 727c1d4b3aSAkinori MUSHAand 737c1d4b3aSAkinori MUSHA.Ic -iregex 74fbccd9dbSRuslan Ermilovprimaries as extended (modern) regular expressions rather than basic 75bfd12208SRuslan Ermilovregular expressions (BRE's). 76bfd12208SRuslan ErmilovThe 777c1d4b3aSAkinori MUSHA.Xr re_format 7 787c1d4b3aSAkinori MUSHAmanual page fully describes both formats. 799b50d902SRodney W. Grimes.It Fl H 803c94f41fSPhilippe CharnierCause the file information and file type (see 819b50d902SRodney W. Grimes.Xr stat 2 ) 829b50d902SRodney W. Grimesreturned for each symbolic link specified on the command line to be 839b50d902SRodney W. Grimesthose of the file referenced by the link, not the link itself. 849b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will 856df69548SBruce Evansbe for the link itself. 866df69548SBruce EvansFile information of all symbolic links not on 879b50d902SRodney W. Grimesthe command line is that of the link itself. 889b50d902SRodney W. Grimes.It Fl L 893c94f41fSPhilippe CharnierCause the file information and file type (see 909b50d902SRodney W. Grimes.Xr stat 2 ) 919b50d902SRodney W. Grimesreturned for each symbolic link to be those of the file referenced by the 929b50d902SRodney W. Grimeslink, not the link itself. 939b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will 949b50d902SRodney W. Grimesbe for the link itself. 9547d91ba3SDag-Erling Smørgrav.Pp 9647d91ba3SDag-Erling SmørgravThis option is equivalent to the deprecated 9747d91ba3SDag-Erling Smørgrav.Ic -follow 9847d91ba3SDag-Erling Smørgravprimary. 999b50d902SRodney W. Grimes.It Fl P 1003c94f41fSPhilippe CharnierCause the file information and file type (see 1019b50d902SRodney W. Grimes.Xr stat 2 ) 1029b50d902SRodney W. Grimesreturned for each symbolic link to be those of the link itself. 1033d9a9402SJohn PolstraThis is the default. 1049b50d902SRodney W. Grimes.It Fl X 1053c94f41fSPhilippe CharnierPermit 1069b50d902SRodney W. Grimes.Nm 1079b50d902SRodney W. Grimesto be safely used in conjunction with 1089b50d902SRodney W. Grimes.Xr xargs 1 . 1099b50d902SRodney W. GrimesIf a file name contains any of the delimiting characters used by 110bfd12208SRuslan Ermilov.Xr xargs 1 , 1119b50d902SRodney W. Grimesa diagnostic message is displayed on standard error, and the file 1129b50d902SRodney W. Grimesis skipped. 113bfd12208SRuslan ErmilovThe delimiting characters include single 114bfd12208SRuslan Ermilov.Pq Dq Li " ' " 115bfd12208SRuslan Ermilovand double 116bfd12208SRuslan Ermilov.Pq Dq Li " \*q " 117bfd12208SRuslan Ermilovquotes, backslash 118bfd12208SRuslan Ermilov.Pq Dq Li \e , 119bfd12208SRuslan Ermilovspace, tab and newline characters. 120a8d50686STom Rhodes.Pp 121a8d50686STom RhodesHowever, you may wish to consider the 122a8d50686STom Rhodes.Fl print0 123a8d50686STom Rhodesprimary in conjunction with 124e2f8ed51SRuslan Ermilov.Dq Nm xargs Fl 0 125a8d50686STom Rhodesas an effective alternative. 1269b50d902SRodney W. Grimes.It Fl d 1273c94f41fSPhilippe CharnierCause 1288fe908efSRuslan Ermilov.Nm 12954874bb6SRuslan Ermilovto perform a depth-first traversal, i.e., directories 13054874bb6SRuslan Ermilovare visited in post-order and all entries in a directory will be acted 1319b50d902SRodney W. Grimeson before the directory itself. 1329b50d902SRodney W. GrimesBy default, 1338fe908efSRuslan Ermilov.Nm 13454874bb6SRuslan Ermilovvisits directories in pre-order, i.e., before their contents. 1359b50d902SRodney W. GrimesNote, the default is 136bfd12208SRuslan Ermilov.Em not 13754874bb6SRuslan Ermilova breadth-first traversal. 13847d91ba3SDag-Erling Smørgrav.Pp 1391c832963SOliver EikemeierThis option is equivalent to the 14047d91ba3SDag-Erling Smørgrav.Ic -depth 1411c832963SOliver Eikemeierprimary of 1421c832963SOliver Eikemeier.St -p1003.1-2001 . 143fbccd9dbSRuslan ErmilovThe 1441c832963SOliver Eikemeier.Fl d 145fbccd9dbSRuslan Ermilovoption 1461c832963SOliver Eikemeiercan be useful when 1471c832963SOliver Eikemeier.Nm 1481c832963SOliver Eikemeieris used with 1491c832963SOliver Eikemeier.Xr cpio 1 1501c832963SOliver Eikemeierto process files that are contained in directories with unusual permissions. 1511c832963SOliver EikemeierIt ensures that you have write permission while you are placing files in a 1521c832963SOliver Eikemeierdirectory, then sets the directory's permissions as the last thing. 1539b50d902SRodney W. Grimes.It Fl f 1543c94f41fSPhilippe CharnierSpecify a file hierarchy for 1558fe908efSRuslan Ermilov.Nm 1569b50d902SRodney W. Grimesto traverse. 1579b50d902SRodney W. GrimesFile hierarchies may also be specified as the operands immediately 1589b50d902SRodney W. Grimesfollowing the options. 1596d0c7e13SWolfram Schneider.It Fl s 1603c94f41fSPhilippe CharnierCause 1618fe908efSRuslan Ermilov.Nm 1626df69548SBruce Evansto traverse the file hierarchies in lexicographical order, 1636df69548SBruce Evansi.e., alphabetical order within each directory. 1646df69548SBruce EvansNote: 165bfd12208SRuslan Ermilov.Ql find -s 1666d0c7e13SWolfram Schneiderand 167bfd12208SRuslan Ermilov.Ql "find | sort" 1686d0c7e13SWolfram Schneidermay give different results. 1699b50d902SRodney W. Grimes.It Fl x 1703c94f41fSPhilippe CharnierPrevent 1718fe908efSRuslan Ermilov.Nm 1729b50d902SRodney W. Grimesfrom descending into directories that have a device number different 1739b50d902SRodney W. Grimesthan that of the file from which the descent began. 17447d91ba3SDag-Erling Smørgrav.Pp 17547d91ba3SDag-Erling SmørgravThis option is equivalent to the deprecated 17647d91ba3SDag-Erling Smørgrav.Ic -xdev 17747d91ba3SDag-Erling Smørgravprimary. 1789b50d902SRodney W. Grimes.El 1799b50d902SRodney W. Grimes.Sh PRIMARIES 180*be2cad28SGlen Barber.Pp 181*be2cad28SGlen BarberAll primaries which take a numeric argument allow the number to be 182*be2cad28SGlen Barberpreceded by a plus sign 183*be2cad28SGlen Barber.Pq Dq Li + 184*be2cad28SGlen Barberor a minus sign 185*be2cad28SGlen Barber.Pq Dq Li - . 186*be2cad28SGlen BarberA preceding plus sign means 187*be2cad28SGlen Barber.Dq more than n , 188*be2cad28SGlen Barbera preceding minus sign means 189*be2cad28SGlen Barber.Dq less than n 190*be2cad28SGlen Barberand neither means 191*be2cad28SGlen Barber.Dq exactly n . 192bfd12208SRuslan Ermilov.Bl -tag -width indent 19331d53425SCeri Davies.It Ic -Bmin Ar n 19431d53425SCeri DaviesTrue if the difference between the time of a file's inode creation 19531d53425SCeri Daviesand the time 19631d53425SCeri Davies.Nm 19731d53425SCeri Davieswas started, rounded up to the next full minute, is 19831d53425SCeri Davies.Ar n 19931d53425SCeri Daviesminutes. 20031d53425SCeri Davies.It Ic -Bnewer Ar file 20131d53425SCeri DaviesSame as 20231d53425SCeri Davies.Ic -newerBm . 20331d53425SCeri Davies.It Ic -Btime Ar n Ns Op Cm smhdw 20431d53425SCeri DaviesIf no units are specified, this primary evaluates to 20531d53425SCeri Daviestrue if the difference between the time of a file's inode creation 20631d53425SCeri Daviesand the time 20731d53425SCeri Davies.Nm 20831d53425SCeri Davieswas started, rounded up to the next full 24-hour period, is 20931d53425SCeri Davies.Ar n 21031d53425SCeri Davies24-hour periods. 21131d53425SCeri Davies.Pp 21231d53425SCeri DaviesIf units are specified, this primary evaluates to 2133b0fbd31SRuslan Ermilovtrue if the difference between the time of a file's inode creation 2143b0fbd31SRuslan Ermilovand the time 21531d53425SCeri Davies.Nm 21631d53425SCeri Davieswas started is exactly 21731d53425SCeri Davies.Ar n 21831d53425SCeri Daviesunits. 21931d53425SCeri DaviesPlease refer to the 22031d53425SCeri Davies.Ic -atime 22131d53425SCeri Daviesprimary description for information on supported time units. 22253e87059STom Rhodes.It Ic -acl 223fbccd9dbSRuslan ErmilovMay be used in conjunction with other primaries to locate 22453e87059STom Rhodesfiles with extended ACLs. 22553e87059STom RhodesSee 22653e87059STom Rhodes.Xr acl 3 22753e87059STom Rhodesfor more information. 2283f5223f8SWolfram Schneider.It Ic -amin Ar n 2293f5223f8SWolfram SchneiderTrue if the difference between the file last access time and the time 2308fe908efSRuslan Ermilov.Nm 23145fe9882SMatthew Huntwas started, rounded up to the next full minute, is 2323f5223f8SWolfram Schneider.Ar n 23345fe9882SMatthew Huntminutes. 234ea92232aSPoul-Henning Kamp.It Ic -anewer Ar file 235ea92232aSPoul-Henning KampSame as 236ea92232aSPoul-Henning Kamp.Ic -neweram . 237adff4fcaSRuslan Ermilov.It Ic -atime Ar n Ns Op Cm smhdw 238adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to 239adff4fcaSRuslan Ermilovtrue if the difference between the file last access time and the time 2408fe908efSRuslan Ermilov.Nm 24154874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is 2429b50d902SRodney W. Grimes.Ar n 24354874bb6SRuslan Ermilov24-hour periods. 244adff4fcaSRuslan Ermilov.Pp 245adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to 246adff4fcaSRuslan Ermilovtrue if the difference between the file last access time and the time 247adff4fcaSRuslan Ermilov.Nm 248adff4fcaSRuslan Ermilovwas started is exactly 249adff4fcaSRuslan Ermilov.Ar n 250adff4fcaSRuslan Ermilovunits. 251adff4fcaSRuslan ErmilovPossible time units are as follows: 252adff4fcaSRuslan Ermilov.Pp 253adff4fcaSRuslan Ermilov.Bl -tag -width indent -compact 254adff4fcaSRuslan Ermilov.It Cm s 255adff4fcaSRuslan Ermilovsecond 256adff4fcaSRuslan Ermilov.It Cm m 257adff4fcaSRuslan Ermilovminute (60 seconds) 258adff4fcaSRuslan Ermilov.It Cm h 259adff4fcaSRuslan Ermilovhour (60 minutes) 260adff4fcaSRuslan Ermilov.It Cm d 261adff4fcaSRuslan Ermilovday (24 hours) 262adff4fcaSRuslan Ermilov.It Cm w 263adff4fcaSRuslan Ermilovweek (7 days) 264adff4fcaSRuslan Ermilov.El 265adff4fcaSRuslan Ermilov.Pp 266adff4fcaSRuslan ErmilovAny number of units may be combined in one 267adff4fcaSRuslan Ermilov.Ic -atime 268adff4fcaSRuslan Ermilovargument, for example, 269adff4fcaSRuslan Ermilov.Dq Li "-atime -1h30m" . 270adff4fcaSRuslan ErmilovUnits are probably only useful when used in conjunction with the 271adff4fcaSRuslan Ermilov.Cm + 272adff4fcaSRuslan Ermilovor 273adff4fcaSRuslan Ermilov.Cm - 274adff4fcaSRuslan Ermilovmodifier. 2753f5223f8SWolfram Schneider.It Ic -cmin Ar n 2763f5223f8SWolfram SchneiderTrue if the difference between the time of last change of file status 2773f5223f8SWolfram Schneiderinformation and the time 2788fe908efSRuslan Ermilov.Nm 27945fe9882SMatthew Huntwas started, rounded up to the next full minute, is 2803f5223f8SWolfram Schneider.Ar n 28145fe9882SMatthew Huntminutes. 282ea92232aSPoul-Henning Kamp.It Ic -cnewer Ar file 283ea92232aSPoul-Henning KampSame as 284ea92232aSPoul-Henning Kamp.Ic -newercm . 285adff4fcaSRuslan Ermilov.It Ic -ctime Ar n Ns Op Cm smhdw 286adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to 287adff4fcaSRuslan Ermilovtrue if the difference between the time of last change of file status 2889b50d902SRodney W. Grimesinformation and the time 2898fe908efSRuslan Ermilov.Nm 29054874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is 2919b50d902SRodney W. Grimes.Ar n 29254874bb6SRuslan Ermilov24-hour periods. 293adff4fcaSRuslan Ermilov.Pp 294adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to 295adff4fcaSRuslan Ermilovtrue if the difference between the time of last change of file status 296adff4fcaSRuslan Ermilovinformation and the time 297adff4fcaSRuslan Ermilov.Nm 298adff4fcaSRuslan Ermilovwas started is exactly 299adff4fcaSRuslan Ermilov.Ar n 300adff4fcaSRuslan Ermilovunits. 301adff4fcaSRuslan ErmilovPlease refer to the 302adff4fcaSRuslan Ermilov.Ic -atime 303adff4fcaSRuslan Ermilovprimary description for information on supported time units. 30446b993ffSWarner Losh.It Ic -d 30546b993ffSWarner LoshSame as 30646b993ffSWarner Losh.Ic depth . 30746b993ffSWarner LoshGNU find implements this as a primary in mistaken emulation of 30846b993ffSWarner Losh.Fx 30946b993ffSWarner Losh.Xr find 1 . 310abacbbbfSPeter Wemm.It Ic -delete 3116df69548SBruce EvansDelete found files and/or directories. 3126df69548SBruce EvansAlways returns true. 3136df69548SBruce EvansThis executes 314abacbbbfSPeter Wemmfrom the current working directory as 315abacbbbfSPeter Wemm.Nm 3166df69548SBruce Evansrecurses down the tree. 317bfd12208SRuslan ErmilovIt will not attempt to delete a filename with a 318bfd12208SRuslan Ermilov.Dq Pa / 319bfd12208SRuslan Ermilovcharacter in its pathname relative to 320bfd12208SRuslan Ermilov.Dq Pa \&. 321bfd12208SRuslan Ermilovfor security reasons. 32254874bb6SRuslan ErmilovDepth-first traversal processing is implied by this option. 323a05cb852SJilles TjoelkerFollowing symlinks is incompatible with this option. 3249b4e871aSDavid E. O'Brien.It Ic -depth 3259b4e871aSDavid E. O'BrienAlways true; 3269b4e871aSDavid E. O'Briensame as the 3279b4e871aSDavid E. O'Brien.Fl d 3289b4e871aSDavid E. O'Brienoption. 3291c832963SOliver Eikemeier.It Ic -depth Ar n 3301c832963SOliver EikemeierTrue if the depth of the file relative to the starting point of the traversal 3311c832963SOliver Eikemeieris 3321c832963SOliver Eikemeier.Ar n . 333ed1a4621SPeter Wemm.It Ic -empty 334ed1a4621SPeter WemmTrue if the current file or directory is empty. 335c93e83feSRuslan Ermilov.It Ic -exec Ar utility Oo Ar argument ... Oc Li \&; 3369b50d902SRodney W. GrimesTrue if the program named 3379b50d902SRodney W. Grimes.Ar utility 3389b50d902SRodney W. Grimesreturns a zero value as its exit status. 339bfd12208SRuslan ErmilovOptional 340bfd12208SRuslan Ermilov.Ar arguments 341bfd12208SRuslan Ermilovmay be passed to the utility. 342bfd12208SRuslan ErmilovThe expression must be terminated by a semicolon 343bfd12208SRuslan Ermilov.Pq Dq Li \&; . 3446a2b59f8SJens SchweikhardtIf you invoke 3456a2b59f8SJens Schweikhardt.Nm 3466a2b59f8SJens Schweikhardtfrom a shell you may need to quote the semicolon if the shell would 3476a2b59f8SJens Schweikhardtotherwise treat it as a control operator. 348bfd12208SRuslan ErmilovIf the string 349bfd12208SRuslan Ermilov.Dq Li {} 350bfd12208SRuslan Ermilovappears anywhere in the utility name or the 3519b50d902SRodney W. Grimesarguments it is replaced by the pathname of the current file. 3529b50d902SRodney W. Grimes.Ar Utility 3539b50d902SRodney W. Grimeswill be executed from the directory from which 3548fe908efSRuslan Ermilov.Nm 3559b50d902SRodney W. Grimeswas executed. 35608274979SYaroslav Tykhiy.Ar Utility 35708274979SYaroslav Tykhiyand 35808274979SYaroslav Tykhiy.Ar arguments 35908274979SYaroslav Tykhiyare not subject to the further expansion of shell patterns 36008274979SYaroslav Tykhiyand constructs. 361c93e83feSRuslan Ermilov.It Ic -exec Ar utility Oo Ar argument ... Oc Li {} + 3625e25d888STim J. RobbinsSame as 3635e25d888STim J. Robbins.Ic -exec , 3645e25d888STim J. Robbinsexcept that 3655e25d888STim J. Robbins.Dq Li {} 3665e25d888STim J. Robbinsis replaced with as many pathnames as possible for each invocation of 3675e25d888STim J. Robbins.Ar utility . 3685e25d888STim J. RobbinsThis behaviour is similar to that of 3695e25d888STim J. Robbins.Xr xargs 1 . 370c93e83feSRuslan Ermilov.It Ic -execdir Ar utility Oo Ar argument ... Oc Li \&; 371127d7563SWarner LoshThe 372bfd12208SRuslan Ermilov.Ic -execdir 373127d7563SWarner Loshprimary is identical to the 374127d7563SWarner Losh.Ic -exec 375127d7563SWarner Loshprimary with the exception that 376bfd12208SRuslan Ermilov.Ar utility 377127d7563SWarner Loshwill be executed from the directory that holds 3786df69548SBruce Evansthe current file. 3796df69548SBruce EvansThe filename substituted for 380bfd12208SRuslan Ermilovthe string 381bfd12208SRuslan Ermilov.Dq Li {} 382bfd12208SRuslan Ermilovis not qualified. 38346b993ffSWarner Losh.It Ic -execdir Ar utility Oo Ar argument ... Oc Li {} + 38446b993ffSWarner LoshSame as 38546b993ffSWarner Losh.Ic -execdir , 38646b993ffSWarner Loshexcept that 38746b993ffSWarner Losh.Dq Li {} 38846b993ffSWarner Loshis replaced with as many pathnames as possible for each invocation of 38946b993ffSWarner Losh.Ar utility . 39046b993ffSWarner LoshThis behaviour is similar to that of 39146b993ffSWarner Losh.Xr xargs 1 . 3927fd5ee41SRuslan Ermilov.It Ic -flags Oo Cm - Ns | Ns Cm + Oc Ns Ar flags , Ns Ar notflags 3937fd5ee41SRuslan ErmilovThe flags are specified using symbolic names (see 394208691fcSRuslan Ermilov.Xr chflags 1 ) . 3957fd5ee41SRuslan ErmilovThose with the 3967fd5ee41SRuslan Ermilov.Qq Li no 3977fd5ee41SRuslan Ermilovprefix (except 3987fd5ee41SRuslan Ermilov.Qq Li nodump ) 3997fd5ee41SRuslan Ermilovare said to be 4007fd5ee41SRuslan Ermilov.Ar notflags . 4017fd5ee41SRuslan ErmilovFlags in 4027fd5ee41SRuslan Ermilov.Ar flags 4037fd5ee41SRuslan Ermilovare checked to be set, and flags in 4047fd5ee41SRuslan Ermilov.Ar notflags 4057fd5ee41SRuslan Ermilovare checked to be not set. 406208691fcSRuslan ErmilovNote that this is different from 407208691fcSRuslan Ermilov.Ic -perm , 4087fd5ee41SRuslan Ermilovwhich only allows the user to specify mode bits that are set. 4097fd5ee41SRuslan Ermilov.Pp 4107fd5ee41SRuslan ErmilovIf flags are preceded by a dash 4117fd5ee41SRuslan Ermilov.Pq Dq Li - , 4127fd5ee41SRuslan Ermilovthis primary evaluates to true 4137fd5ee41SRuslan Ermilovif at least all of the bits in 4147fd5ee41SRuslan Ermilov.Ar flags 4157fd5ee41SRuslan Ermilovand none of the bits in 4167fd5ee41SRuslan Ermilov.Ar notflags 4177fd5ee41SRuslan Ermilovare set in the file's flags bits. 4187fd5ee41SRuslan ErmilovIf flags are preceded by a plus 4197fd5ee41SRuslan Ermilov.Pq Dq Li + , 4207fd5ee41SRuslan Ermilovthis primary evaluates to true 4217fd5ee41SRuslan Ermilovif any of the bits in 4227fd5ee41SRuslan Ermilov.Ar flags 4237fd5ee41SRuslan Ermilovis set in the file's flags bits, 4247fd5ee41SRuslan Ermilovor any of the bits in 4257fd5ee41SRuslan Ermilov.Ar notflags 4267fd5ee41SRuslan Ermilovis not set in the file's flags bits. 4277fd5ee41SRuslan ErmilovOtherwise, 4287fd5ee41SRuslan Ermilovthis primary evaluates to true 4297fd5ee41SRuslan Ermilovif the bits in 4307fd5ee41SRuslan Ermilov.Ar flags 4317fd5ee41SRuslan Ermilovexactly match the file's flags bits, 4327fd5ee41SRuslan Ermilovand none of the 4337fd5ee41SRuslan Ermilov.Ar flags 4347fd5ee41SRuslan Ermilovbits match those of 4357fd5ee41SRuslan Ermilov.Ar notflags . 4369b50d902SRodney W. Grimes.It Ic -fstype Ar type 4379b50d902SRodney W. GrimesTrue if the file is contained in a file system of type 4389b50d902SRodney W. Grimes.Ar type . 439841484cdSPeter WemmThe 440d740b7c7SPawel Jakub Dawidek.Xr lsvfs 1 441841484cdSPeter Wemmcommand can be used to find out the types of file systems 442d740b7c7SPawel Jakub Dawidekthat are available on the system. 443bfd12208SRuslan ErmilovIn addition, there are two pseudo-types, 444bfd12208SRuslan Ermilov.Dq Li local 445bfd12208SRuslan Ermilovand 446bfd12208SRuslan Ermilov.Dq Li rdonly . 4479b50d902SRodney W. GrimesThe former matches any file system physically mounted on the system where 4489b50d902SRodney W. Grimesthe 4498fe908efSRuslan Ermilov.Nm 4509b50d902SRodney W. Grimesis being executed and the latter matches any file system which is 4519b50d902SRodney W. Grimesmounted read-only. 45246b993ffSWarner Losh.It Ic -gid Ar gname 45346b993ffSWarner LoshThe same thing as 45446b993ffSWarner Losh.Ar -group Ar gname 45546b993ffSWarner Loshfor compatibility with GNU find. 45646b993ffSWarner LoshGNU find imposes a restriction that 45746b993ffSWarner Losh.Ar gname 45846b993ffSWarner Loshis numeric, while 45946b993ffSWarner Losh.Xr find 1 46046b993ffSWarner Loshdoes not. 4619b50d902SRodney W. Grimes.It Ic -group Ar gname 4629b50d902SRodney W. GrimesTrue if the file belongs to the group 4639b50d902SRodney W. Grimes.Ar gname . 4649b50d902SRodney W. GrimesIf 4659b50d902SRodney W. Grimes.Ar gname 4669b50d902SRodney W. Grimesis numeric and there is no such group name, then 4679b50d902SRodney W. Grimes.Ar gname 468bfd12208SRuslan Ermilovis treated as a group ID. 46946b993ffSWarner Losh.It Ic -ignore_readdir_race 47046b993ffSWarner LoshThis option is for GNU find compatibility and is ignored. 47146b993ffSWarner Losh.It Ic -ilname Ar pattern 47246b993ffSWarner LoshLike 47346b993ffSWarner Losh.Ic -lname , 47446b993ffSWarner Loshbut the match is case insensitive. 475a66a6a2aSWarner LoshThis is a GNU find extension. 476208691fcSRuslan Ermilov.It Ic -iname Ar pattern 477208691fcSRuslan ErmilovLike 478208691fcSRuslan Ermilov.Ic -name , 479208691fcSRuslan Ermilovbut the match is case insensitive. 4809b50d902SRodney W. Grimes.It Ic -inum Ar n 4819b50d902SRodney W. GrimesTrue if the file has inode number 4829b50d902SRodney W. Grimes.Ar n . 483208691fcSRuslan Ermilov.It Ic -ipath Ar pattern 484208691fcSRuslan ErmilovLike 485208691fcSRuslan Ermilov.Ic -path , 486208691fcSRuslan Ermilovbut the match is case insensitive. 487208691fcSRuslan Ermilov.It Ic -iregex Ar pattern 488208691fcSRuslan ErmilovLike 489208691fcSRuslan Ermilov.Ic -regex , 490208691fcSRuslan Ermilovbut the match is case insensitive. 49146b993ffSWarner Losh.It Ic -iwholename Ar pattern 49246b993ffSWarner LoshThe same thing as 49346b993ffSWarner Losh.Ic -ipath , 49446b993ffSWarner Loshfor GNU find compatibility. 4959b50d902SRodney W. Grimes.It Ic -links Ar n 4969b50d902SRodney W. GrimesTrue if the file has 4979b50d902SRodney W. Grimes.Ar n 4989b50d902SRodney W. Grimeslinks. 49946b993ffSWarner Losh.It Ic -lname Ar pattern 50046b993ffSWarner LoshLike 50146b993ffSWarner Losh.Ic -name , 502a66a6a2aSWarner Loshbut the contents of the symbolic link are matched instead of the file 503a66a6a2aSWarner Loshname. 504a66a6a2aSWarner LoshThis is a GNU find extension. 5059b50d902SRodney W. Grimes.It Ic -ls 5069b50d902SRodney W. GrimesThis primary always evaluates to true. 5079b50d902SRodney W. GrimesThe following information for the current file is written to standard output: 50854874bb6SRuslan Ermilovits inode number, size in 512-byte blocks, file permissions, number of hard 5099b50d902SRodney W. Grimeslinks, owner, group, size in bytes, last modification time, and pathname. 5109b50d902SRodney W. GrimesIf the file is a block or character special file, the major and minor numbers 5119b50d902SRodney W. Grimeswill be displayed instead of the size in bytes. 51254874bb6SRuslan ErmilovIf the file is a symbolic link, the pathname of the linked-to file will be 513bfd12208SRuslan Ermilovdisplayed preceded by 514bfd12208SRuslan Ermilov.Dq Li -> . 515bfd12208SRuslan ErmilovThe format is identical to that produced by 516bfd12208SRuslan Ermilov.Bk -words 517fbccd9dbSRuslan Ermilov.Dq Nm ls Fl dgils . 518bfd12208SRuslan Ermilov.Ek 519c76bc8f3SOllivier Robert.It Ic -maxdepth Ar n 5209c61111dSOliver EikemeierAlways true; descend at most 5219c61111dSOliver Eikemeier.Ar n 5229c61111dSOliver Eikemeierdirectory levels below the command line arguments. 523d79829afSOliver EikemeierIf any 524d79829afSOliver Eikemeier.Ic -maxdepth 525d79829afSOliver Eikemeierprimary is specified, it applies to the entire expression even if it would 526d79829afSOliver Eikemeiernot normally be evaluated. 527fbccd9dbSRuslan Ermilov.Dq Ic -maxdepth Li 0 528d79829afSOliver Eikemeierlimits the whole search to the command line arguments. 529c76bc8f3SOllivier Robert.It Ic -mindepth Ar n 5309c61111dSOliver EikemeierAlways true; do not apply any tests or actions at levels less than 5319c61111dSOliver Eikemeier.Ar n . 532d79829afSOliver EikemeierIf any 533d79829afSOliver Eikemeier.Ic -mindepth 534d79829afSOliver Eikemeierprimary is specified, it applies to the entire expression even if it would 535d79829afSOliver Eikemeiernot normally be evaluated. 536fbccd9dbSRuslan Ermilov.Dq Ic -mindepth Li 1 537d79829afSOliver Eikemeierprocesses all but the command line arguments. 5383f5223f8SWolfram Schneider.It Ic -mmin Ar n 5393f5223f8SWolfram SchneiderTrue if the difference between the file last modification time and the time 5408fe908efSRuslan Ermilov.Nm 54145fe9882SMatthew Huntwas started, rounded up to the next full minute, is 5423f5223f8SWolfram Schneider.Ar n 54345fe9882SMatthew Huntminutes. 544208691fcSRuslan Ermilov.It Ic -mnewer Ar file 545208691fcSRuslan ErmilovSame as 546208691fcSRuslan Ermilov.Ic -newer . 54746b993ffSWarner Losh.It Ic -mount 54846b993ffSWarner LoshThe same thing as 54946b993ffSWarner Losh.Ic -xdev , 55046b993ffSWarner Loshfor GNU find compatibility. 551adff4fcaSRuslan Ermilov.It Ic -mtime Ar n Ns Op Cm smhdw 552adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to 553adff4fcaSRuslan Ermilovtrue if the difference between the file last modification time and the time 5548fe908efSRuslan Ermilov.Nm 55554874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is 5569b50d902SRodney W. Grimes.Ar n 55754874bb6SRuslan Ermilov24-hour periods. 558adff4fcaSRuslan Ermilov.Pp 559adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to 560adff4fcaSRuslan Ermilovtrue if the difference between the file last modification time and the time 561adff4fcaSRuslan Ermilov.Nm 562adff4fcaSRuslan Ermilovwas started is exactly 563adff4fcaSRuslan Ermilov.Ar n 564adff4fcaSRuslan Ermilovunits. 565adff4fcaSRuslan ErmilovPlease refer to the 566adff4fcaSRuslan Ermilov.Ic -atime 567adff4fcaSRuslan Ermilovprimary description for information on supported time units. 5689b50d902SRodney W. Grimes.It Ic -name Ar pattern 5699b50d902SRodney W. GrimesTrue if the last component of the pathname being examined matches 5709b50d902SRodney W. Grimes.Ar pattern . 571bfd12208SRuslan ErmilovSpecial shell pattern matching characters 572bfd12208SRuslan Ermilov.Dq ( Li \&[ , 573bfd12208SRuslan Ermilov.Dq Li \&] , 574bfd12208SRuslan Ermilov.Dq Li * , 575bfd12208SRuslan Ermilovand 576bfd12208SRuslan Ermilov.Dq Li \&? ) 5779b50d902SRodney W. Grimesmay be used as part of 5789b50d902SRodney W. Grimes.Ar pattern . 5799b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a 580bfd12208SRuslan Ermilovbackslash 581bfd12208SRuslan Ermilov.Pq Dq Li \e . 5829b50d902SRodney W. Grimes.It Ic -newer Ar file 5839b50d902SRodney W. GrimesTrue if the current file has a more recent last modification time than 5849b50d902SRodney W. Grimes.Ar file . 585bfd12208SRuslan Ermilov.It Ic -newer Ns Ar X Ns Ar Y Ar file 586bfd12208SRuslan ErmilovTrue if the current file has a more recent last access time 587fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm a , 58831d53425SCeri Daviesinode creation time 589fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm B , 590bfd12208SRuslan Ermilovchange time 591fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm c , 592bfd12208SRuslan Ermilovor modification time 593fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm m 594bfd12208SRuslan Ermilovthan the last access time 595fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm a , 59631d53425SCeri Daviesinode creation time 597fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm B , 598bfd12208SRuslan Ermilovchange time 599fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm c , 600bfd12208SRuslan Ermilovor modification time 601fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm m 602bfd12208SRuslan Ermilovof 603ea92232aSPoul-Henning Kamp.Ar file . 604ea92232aSPoul-Henning KampIn addition, if 605bfd12208SRuslan Ermilov.Ar Y Ns = Ns Cm t , 606ea92232aSPoul-Henning Kampthen 607ea92232aSPoul-Henning Kamp.Ar file 608ea92232aSPoul-Henning Kampis instead interpreted as a direct date specification of the form 609ea92232aSPoul-Henning Kampunderstood by 610ea92232aSPoul-Henning Kamp.Xr cvs 1 . 611ea92232aSPoul-Henning KampNote that 612ea92232aSPoul-Henning Kamp.Ic -newermm 613ea92232aSPoul-Henning Kampis equivalent to 614ea92232aSPoul-Henning Kamp.Ic -newer . 6159b50d902SRodney W. Grimes.It Ic -nogroup 6169b50d902SRodney W. GrimesTrue if the file belongs to an unknown group. 61746b993ffSWarner Losh.It Ic -noignore_readdir_race 61846b993ffSWarner LoshThis option is for GNU find compatibility and is ignored. 61946b993ffSWarner Losh.It Ic -noleaf 62046b993ffSWarner LoshThis option is for GNU find compatibility. 62146b993ffSWarner LoshIn GNU find it disables an optimization not relevant to 62246b993ffSWarner Losh.Xr find 1 , 62346b993ffSWarner Loshso it is ignored. 624208691fcSRuslan Ermilov.It Ic -nouser 625208691fcSRuslan ErmilovTrue if the file belongs to an unknown user. 626c93e83feSRuslan Ermilov.It Ic -ok Ar utility Oo Ar argument ... Oc Li \&; 627208691fcSRuslan ErmilovThe 628208691fcSRuslan Ermilov.Ic -ok 629208691fcSRuslan Ermilovprimary is identical to the 630208691fcSRuslan Ermilov.Ic -exec 631208691fcSRuslan Ermilovprimary with the exception that 632208691fcSRuslan Ermilov.Nm 633208691fcSRuslan Ermilovrequests user affirmation for the execution of the 634208691fcSRuslan Ermilov.Ar utility 635208691fcSRuslan Ermilovby printing 636208691fcSRuslan Ermilova message to the terminal and reading a response. 63739c59153SRuslan ErmilovIf the response is not affirmative 63839c59153SRuslan Ermilov.Ql ( y 639ef6c7764STim J. Robbinsin the 640ef6c7764STim J. Robbins.Dq Li POSIX 641ef6c7764STim J. Robbinslocale), 642208691fcSRuslan Ermilovthe command is not executed and the 643208691fcSRuslan Ermilovvalue of the 644208691fcSRuslan Ermilov.Ic -ok 645208691fcSRuslan Ermilovexpression is false. 646c93e83feSRuslan Ermilov.It Ic -okdir Ar utility Oo Ar argument ... Oc Li \&; 647208691fcSRuslan ErmilovThe 648208691fcSRuslan Ermilov.Ic -okdir 649208691fcSRuslan Ermilovprimary is identical to the 650208691fcSRuslan Ermilov.Ic -execdir 651208691fcSRuslan Ermilovprimary with the same exception as described for the 652208691fcSRuslan Ermilov.Ic -ok 653208691fcSRuslan Ermilovprimary. 6549b50d902SRodney W. Grimes.It Ic -path Ar pattern 6559b50d902SRodney W. GrimesTrue if the pathname being examined matches 6569b50d902SRodney W. Grimes.Ar pattern . 657bfd12208SRuslan ErmilovSpecial shell pattern matching characters 658bfd12208SRuslan Ermilov.Dq ( Li \&[ , 659bfd12208SRuslan Ermilov.Dq Li \&] , 660bfd12208SRuslan Ermilov.Dq Li * , 661bfd12208SRuslan Ermilovand 662bfd12208SRuslan Ermilov.Dq Li \&? ) 6639b50d902SRodney W. Grimesmay be used as part of 6649b50d902SRodney W. Grimes.Ar pattern . 6659b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a 666bfd12208SRuslan Ermilovbackslash 667bfd12208SRuslan Ermilov.Pq Dq Li \e . 668bfd12208SRuslan ErmilovSlashes 669bfd12208SRuslan Ermilov.Pq Dq Li / 670bfd12208SRuslan Ermilovare treated as normal characters and do not have to be 6719b50d902SRodney W. Grimesmatched explicitly. 6727fd5ee41SRuslan Ermilov.It Ic -perm Oo Cm - Ns | Ns Cm + Oc Ns Ar mode 6739b50d902SRodney W. GrimesThe 6749b50d902SRodney W. Grimes.Ar mode 6759b50d902SRodney W. Grimesmay be either symbolic (see 6769b50d902SRodney W. Grimes.Xr chmod 1 ) 6779b50d902SRodney W. Grimesor an octal number. 6787fd5ee41SRuslan ErmilovIf the 6797fd5ee41SRuslan Ermilov.Ar mode 6807fd5ee41SRuslan Ermilovis symbolic, a starting value of zero is assumed and the 6817fd5ee41SRuslan Ermilov.Ar mode 6827fd5ee41SRuslan Ermilovsets or clears permissions without regard to the process' file mode 6839b50d902SRodney W. Grimescreation mask. 6847fd5ee41SRuslan ErmilovIf the 6857fd5ee41SRuslan Ermilov.Ar mode 6867fd5ee41SRuslan Ermilovis octal, only bits 07777 687bfd12208SRuslan Ermilov.Pq Dv S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO 6889b50d902SRodney W. Grimesof the file's mode bits participate 6899b50d902SRodney W. Grimesin the comparison. 6907fd5ee41SRuslan ErmilovIf the 6917fd5ee41SRuslan Ermilov.Ar mode 6927fd5ee41SRuslan Ermilovis preceded by a dash 693bfd12208SRuslan Ermilov.Pq Dq Li - , 6949b88faecSRuslan Ermilovthis primary evaluates to true 6957fd5ee41SRuslan Ermilovif at least all of the bits in the 6967fd5ee41SRuslan Ermilov.Ar mode 6977fd5ee41SRuslan Ermilovare set in the file's mode bits. 6987fd5ee41SRuslan ErmilovIf the 6997fd5ee41SRuslan Ermilov.Ar mode 7007fd5ee41SRuslan Ermilovis preceded by a plus 701bfd12208SRuslan Ermilov.Pq Dq Li + , 7029b88faecSRuslan Ermilovthis primary evaluates to true 7037fd5ee41SRuslan Ermilovif any of the bits in the 7047fd5ee41SRuslan Ermilov.Ar mode 7057fd5ee41SRuslan Ermilovare set in the file's mode bits. 7069d2796c3SOllivier RobertOtherwise, this primary evaluates to true if 7077fd5ee41SRuslan Ermilovthe bits in the 7087fd5ee41SRuslan Ermilov.Ar mode 7097fd5ee41SRuslan Ermilovexactly match the file's mode bits. 710bfd12208SRuslan ErmilovNote, the first character of a symbolic mode may not be a dash 711bfd12208SRuslan Ermilov.Pq Dq Li - . 7129b50d902SRodney W. Grimes.It Ic -print 7139b50d902SRodney W. GrimesThis primary always evaluates to true. 7149b50d902SRodney W. GrimesIt prints the pathname of the current file to standard output. 715841484cdSPeter WemmIf none of 716bfd12208SRuslan Ermilov.Ic -exec , -ls , -print0 , 7179b50d902SRodney W. Grimesor 718bfd12208SRuslan Ermilov.Ic -ok 719841484cdSPeter Wemmis specified, the given expression shall be effectively replaced by 720bfd12208SRuslan Ermilov.Cm \&( Ar "given expression" Cm \&) Ic -print . 7217cd23434SGarrett Wollman.It Ic -print0 7227cd23434SGarrett WollmanThis primary always evaluates to true. 723fbe0d04aSMasafumi Max NAKANEIt prints the pathname of the current file to standard output, followed by an 724cb29445aSRuslan Ermilov.Tn ASCII 725cb29445aSRuslan Ermilov.Dv NUL 7267cd23434SGarrett Wollmancharacter (character code 0). 7279b50d902SRodney W. Grimes.It Ic -prune 7289b50d902SRodney W. GrimesThis primary always evaluates to true. 7299b50d902SRodney W. GrimesIt causes 7308fe908efSRuslan Ermilov.Nm 7319b50d902SRodney W. Grimesto not descend into the current file. 7329b50d902SRodney W. GrimesNote, the 7339b50d902SRodney W. Grimes.Ic -prune 7349b50d902SRodney W. Grimesprimary has no effect if the 7359b50d902SRodney W. Grimes.Fl d 7369b50d902SRodney W. Grimesoption was specified. 737208691fcSRuslan Ermilov.It Ic -regex Ar pattern 738208691fcSRuslan ErmilovTrue if the whole path of the file matches 739208691fcSRuslan Ermilov.Ar pattern 740208691fcSRuslan Ermilovusing regular expression. 741208691fcSRuslan ErmilovTo match a file named 742208691fcSRuslan Ermilov.Dq Pa ./foo/xyzzy , 743208691fcSRuslan Ermilovyou can use the regular expression 744208691fcSRuslan Ermilov.Dq Li ".*/[xyz]*" 745208691fcSRuslan Ermilovor 746208691fcSRuslan Ermilov.Dq Li ".*/foo/.*" , 747208691fcSRuslan Ermilovbut not 748208691fcSRuslan Ermilov.Dq Li xyzzy 749208691fcSRuslan Ermilovor 750208691fcSRuslan Ermilov.Dq Li /foo/ . 75146b993ffSWarner Losh.It Ic -samefile Ar name 75246b993ffSWarner LoshTrue if the file is a hard link to 75346b993ffSWarner Losh.Ar name . 75446b993ffSWarner LoshIf the command option 75546b993ffSWarner Losh.Ic -L 75646b993ffSWarner Loshis specified, it is also true if the file is a symbolic link and 75746b993ffSWarner Loshpoints to 75846b993ffSWarner Losh.Ar name . 7595a890aacSKirill Ponomarev.It Ic -size Ar n Ns Op Cm ckMGTP 76054874bb6SRuslan ErmilovTrue if the file's size, rounded up, in 512-byte blocks is 7619b50d902SRodney W. Grimes.Ar n . 7629b50d902SRodney W. GrimesIf 7639b50d902SRodney W. Grimes.Ar n 764bfd12208SRuslan Ermilovis followed by a 765bfd12208SRuslan Ermilov.Cm c , 766bfd12208SRuslan Ermilovthen the primary is true if the 7679b50d902SRodney W. Grimesfile's size is 7689b50d902SRodney W. Grimes.Ar n 769bfd12208SRuslan Ermilovbytes (characters). 7705a890aacSKirill PonomarevSimilarly if 7715a890aacSKirill Ponomarev.Ar n 7725a890aacSKirill Ponomarevis followed by a scale indicator then the file's size is compared to 7735a890aacSKirill Ponomarev.Ar n 7745a890aacSKirill Ponomarevscaled as: 7755a890aacSKirill Ponomarev.Pp 7765a890aacSKirill Ponomarev.Bl -tag -width indent -compact 7775a890aacSKirill Ponomarev.It Cm k 7785a890aacSKirill Ponomarevkilobytes (1024 bytes) 7795a890aacSKirill Ponomarev.It Cm M 7805a890aacSKirill Ponomarevmegabytes (1024 kilobytes) 7815a890aacSKirill Ponomarev.It Cm G 7825a890aacSKirill Ponomarevgigabytes (1024 megabytes) 7835a890aacSKirill Ponomarev.It Cm T 7845a890aacSKirill Ponomarevterabytes (1024 gigabytes) 7855a890aacSKirill Ponomarev.It Cm P 7865a890aacSKirill Ponomarevpetabytes (1024 terabytes) 7875a890aacSKirill Ponomarev.El 7889b50d902SRodney W. Grimes.It Ic -type Ar t 7899b50d902SRodney W. GrimesTrue if the file is of the specified type. 7909b50d902SRodney W. GrimesPossible file types are as follows: 7919b50d902SRodney W. Grimes.Pp 792bfd12208SRuslan Ermilov.Bl -tag -width indent -compact 7939b50d902SRodney W. Grimes.It Cm b 7949b50d902SRodney W. Grimesblock special 7959b50d902SRodney W. Grimes.It Cm c 7969b50d902SRodney W. Grimescharacter special 7979b50d902SRodney W. Grimes.It Cm d 7989b50d902SRodney W. Grimesdirectory 7999b50d902SRodney W. Grimes.It Cm f 8009b50d902SRodney W. Grimesregular file 8019b50d902SRodney W. Grimes.It Cm l 8029b50d902SRodney W. Grimessymbolic link 8039b50d902SRodney W. Grimes.It Cm p 8049b50d902SRodney W. GrimesFIFO 8059b50d902SRodney W. Grimes.It Cm s 8069b50d902SRodney W. Grimessocket 8079b50d902SRodney W. Grimes.El 80846b993ffSWarner Losh.It Ic -uid Ar uname 80946b993ffSWarner LoshThe same thing as 81046b993ffSWarner Losh.Ar -user Ar uname 81146b993ffSWarner Loshfor compatibility with GNU find. 81246b993ffSWarner LoshGNU find imposes a restriction that 81346b993ffSWarner Losh.Ar uname 81446b993ffSWarner Loshis numeric, while 81546b993ffSWarner Losh.Xr find 1 81646b993ffSWarner Loshdoes not. 8179b50d902SRodney W. Grimes.It Ic -user Ar uname 8189b50d902SRodney W. GrimesTrue if the file belongs to the user 8199b50d902SRodney W. Grimes.Ar uname . 8209b50d902SRodney W. GrimesIf 8219b50d902SRodney W. Grimes.Ar uname 8229b50d902SRodney W. Grimesis numeric and there is no such user name, then 8239b50d902SRodney W. Grimes.Ar uname 824bfd12208SRuslan Ermilovis treated as a user ID. 82546b993ffSWarner Losh.It Ic -wholename Ar pattern 82646b993ffSWarner LoshThe same thing as 82746b993ffSWarner Losh.Ic -path , 82846b993ffSWarner Loshfor GNU find compatibility. 8299b50d902SRodney W. Grimes.El 8309b50d902SRodney W. Grimes.Sh OPERATORS 8319b50d902SRodney W. GrimesThe primaries may be combined using the following operators. 8329b50d902SRodney W. GrimesThe operators are listed in order of decreasing precedence. 833bfd12208SRuslan Ermilov.Pp 834fbccd9dbSRuslan Ermilov.Bl -tag -width indent -compact 8350c101fb2SJoseph Koshy.It Cm \&( Ar expression Cm \&) 8369b50d902SRodney W. GrimesThis evaluates to true if the parenthesized expression evaluates to 8379b50d902SRodney W. Grimestrue. 8389b50d902SRodney W. Grimes.Pp 8390c101fb2SJoseph Koshy.It Cm \&! Ar expression 8404a0193d3SJuli Mallett.It Cm -not Ar expression 8419b50d902SRodney W. GrimesThis is the unary 8429b50d902SRodney W. Grimes.Tn NOT 8439b50d902SRodney W. Grimesoperator. 8449b50d902SRodney W. GrimesIt evaluates to true if the expression is false. 8459b50d902SRodney W. Grimes.Pp 84646b993ffSWarner Losh.It Cm -false 84746b993ffSWarner LoshAlways false. 84846b993ffSWarner Losh.It Cm -true 84946b993ffSWarner LoshAlways true. 85046b993ffSWarner Losh.Pp 8519b50d902SRodney W. Grimes.It Ar expression Cm -and Ar expression 8529b50d902SRodney W. Grimes.It Ar expression expression 8539b50d902SRodney W. GrimesThe 8549b50d902SRodney W. Grimes.Cm -and 8559b50d902SRodney W. Grimesoperator is the logical 8569b50d902SRodney W. Grimes.Tn AND 8579b50d902SRodney W. Grimesoperator. 8589b50d902SRodney W. GrimesAs it is implied by the juxtaposition of two expressions it does not 8599b50d902SRodney W. Grimeshave to be specified. 8609b50d902SRodney W. GrimesThe expression evaluates to true if both expressions are true. 8619b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is false. 8629b50d902SRodney W. Grimes.Pp 8639b50d902SRodney W. Grimes.It Ar expression Cm -or Ar expression 8649b50d902SRodney W. GrimesThe 8659b50d902SRodney W. Grimes.Cm -or 8669b50d902SRodney W. Grimesoperator is the logical 8679b50d902SRodney W. Grimes.Tn OR 8689b50d902SRodney W. Grimesoperator. 8699b50d902SRodney W. GrimesThe expression evaluates to true if either the first or the second expression 8709b50d902SRodney W. Grimesis true. 8719b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is true. 8729b50d902SRodney W. Grimes.El 8739b50d902SRodney W. Grimes.Pp 8749b50d902SRodney W. GrimesAll operands and primaries must be separate arguments to 8758fe908efSRuslan Ermilov.Nm . 8769b50d902SRodney W. GrimesPrimaries which themselves take arguments expect each argument 8779b50d902SRodney W. Grimesto be a separate argument to 8788fe908efSRuslan Ermilov.Nm . 879ef6c7764STim J. Robbins.Sh ENVIRONMENT 880ef6c7764STim J. RobbinsThe 881ef6c7764STim J. Robbins.Ev LANG , LC_ALL , LC_COLLATE , LC_CTYPE , LC_MESSAGES 882ef6c7764STim J. Robbinsand 883ef6c7764STim J. Robbins.Ev LC_TIME 884ef6c7764STim J. Robbinsenvironment variables affect the execution of the 885ef6c7764STim J. Robbins.Nm 886ef6c7764STim J. Robbinsutility as described in 887ef6c7764STim J. Robbins.Xr environ 7 . 8889b50d902SRodney W. Grimes.Sh EXAMPLES 8899b50d902SRodney W. GrimesThe following examples are shown as given to the shell: 890bfd12208SRuslan Ermilov.Bl -tag -width indent 8919b50d902SRodney W. Grimes.It Li "find / \e! -name \*q*.c\*q -print" 892bfd12208SRuslan ErmilovPrint out a list of all the files whose names do not end in 893bfd12208SRuslan Ermilov.Pa .c . 8949b50d902SRodney W. Grimes.It Li "find / -newer ttt -user wnj -print" 895bfd12208SRuslan ErmilovPrint out a list of all the files owned by user 896bfd12208SRuslan Ermilov.Dq wnj 897bfd12208SRuslan Ermilovthat are newer 898bfd12208SRuslan Ermilovthan the file 899bfd12208SRuslan Ermilov.Pa ttt . 9009b50d902SRodney W. Grimes.It Li "find / \e! \e( -newer ttt -user wnj \e) -print" 901bfd12208SRuslan ErmilovPrint out a list of all the files which are not both newer than 902bfd12208SRuslan Ermilov.Pa ttt 903bfd12208SRuslan Ermilovand owned by 904bfd12208SRuslan Ermilov.Dq wnj . 9059b50d902SRodney W. Grimes.It Li "find / \e( -newer ttt -or -user wnj \e) -print" 906bfd12208SRuslan ErmilovPrint out a list of all the files that are either owned by 907bfd12208SRuslan Ermilov.Dq wnj 908bfd12208SRuslan Ermilovor that are newer than 909bfd12208SRuslan Ermilov.Pa ttt . 910e578c242STom Rhodes.It Li "find / -newerct '1 minute ago' -print" 911ea92232aSPoul-Henning KampPrint out a list of all the files whose inode change time is more 912ea92232aSPoul-Henning Kamprecent than the current time minus one minute. 91354874bb6SRuslan Ermilov.It Li "find / -type f -exec echo {} \e;" 914e578c242STom RhodesUse the 915e578c242STom Rhodes.Xr echo 1 916e578c242STom Rhodescommand to print out a list of all the files. 917a05cb852SJilles Tjoelker.It Li "find -L /usr/ports/packages -type l -exec rm -- {} +" 9181c832963SOliver EikemeierDelete all broken symbolic links in 9191c832963SOliver Eikemeier.Pa /usr/ports/packages . 9201c832963SOliver Eikemeier.It Li "find /usr/src -name CVS -prune -o -depth +6 -print" 9211c832963SOliver EikemeierFind files and directories that are at least seven levels deep 9221c832963SOliver Eikemeierin the working directory 9231c832963SOliver Eikemeier.Pa /usr/src . 9241c832963SOliver Eikemeier.It Li "find /usr/src -name CVS -prune -o -mindepth 7 -print" 9251c832963SOliver EikemeierIs not equivalent to the previous example, since 9261c832963SOliver Eikemeier.Ic -prune 9271c832963SOliver Eikemeieris not evaluated below level seven. 9289b50d902SRodney W. Grimes.El 929e578c242STom Rhodes.Sh COMPATIBILITY 930e578c242STom RhodesThe 931e578c242STom Rhodes.Ic -follow 93247d91ba3SDag-Erling Smørgravprimary is deprecated; the 93347d91ba3SDag-Erling Smørgrav.Fl L 93447d91ba3SDag-Erling Smørgravoption should be used instead. 93547d91ba3SDag-Erling SmørgravSee the 93647d91ba3SDag-Erling Smørgrav.Sx STANDARDS 93747d91ba3SDag-Erling Smørgravsection below for details. 9389b50d902SRodney W. Grimes.Sh SEE ALSO 939567664c4SOllivier Robert.Xr chflags 1 , 9409b50d902SRodney W. Grimes.Xr chmod 1 , 941ea92232aSPoul-Henning Kamp.Xr cvs 1 , 9429b50d902SRodney W. Grimes.Xr locate 1 , 943d740b7c7SPawel Jakub Dawidek.Xr lsvfs 1 , 94441cbb624SJoseph Koshy.Xr whereis 1 , 94541cbb624SJoseph Koshy.Xr which 1 , 946a8d50686STom Rhodes.Xr xargs 1 , 9479b50d902SRodney W. Grimes.Xr stat 2 , 94853e87059STom Rhodes.Xr acl 3 , 9499b50d902SRodney W. Grimes.Xr fts 3 , 9509b50d902SRodney W. Grimes.Xr getgrent 3 , 9519b50d902SRodney W. Grimes.Xr getpwent 3 , 9529b50d902SRodney W. Grimes.Xr strmode 3 , 95394ad6032SRuslan Ermilov.Xr re_format 7 , 9549b50d902SRodney W. Grimes.Xr symlink 7 9559b50d902SRodney W. Grimes.Sh STANDARDS 9569b50d902SRodney W. GrimesThe 9578fe908efSRuslan Ermilov.Nm 9589b50d902SRodney W. Grimesutility syntax is a superset of the syntax specified by the 9591c832963SOliver Eikemeier.St -p1003.1-2001 9609b50d902SRodney W. Grimesstandard. 9619b50d902SRodney W. Grimes.Pp 9621c832963SOliver EikemeierAll the single character options except 963fbccd9dbSRuslan Ermilov.Fl H 9641c832963SOliver Eikemeierand 965fbccd9dbSRuslan Ermilov.Fl L 966659a728eSCeri Daviesas well as 967659a728eSCeri Davies.Ic -amin , -anewer , -cmin , -cnewer , -delete , -empty , -fstype , 968659a728eSCeri Davies.Ic -iname , -inum , -iregex , -ls , -maxdepth , -mindepth , -mmin , 969659a728eSCeri Davies.Ic -path , -print0 , -regex 970440a24d8SCeri Daviesand all of the 971fbccd9dbSRuslan Ermilov.Ic -B* 972440a24d8SCeri Daviesbirthtime related primaries are extensions to 9731c832963SOliver Eikemeier.St -p1003.1-2001 . 974f6e4fb22SSteve Price.Pp 9759b50d902SRodney W. GrimesHistorically, the 97647d91ba3SDag-Erling Smørgrav.Fl d , L 9779b50d902SRodney W. Grimesand 9789b50d902SRodney W. Grimes.Fl x 979bfd12208SRuslan Ermilovoptions were implemented using the primaries 980bfd12208SRuslan Ermilov.Ic -depth , -follow , 981bfd12208SRuslan Ermilovand 982bfd12208SRuslan Ermilov.Ic -xdev . 9839b50d902SRodney W. GrimesThese primaries always evaluated to true. 9849b50d902SRodney W. GrimesAs they were really global variables that took effect before the traversal 9859b50d902SRodney W. Grimesbegan, some legal expressions could have unexpected results. 986bfd12208SRuslan ErmilovAn example is the expression 987bfd12208SRuslan Ermilov.Ic -print Cm -o Ic -depth . 988bfd12208SRuslan ErmilovAs 989bfd12208SRuslan Ermilov.Ic -print 990bfd12208SRuslan Ermilovalways evaluates to true, the standard order of evaluation 991bfd12208SRuslan Ermilovimplies that 992bfd12208SRuslan Ermilov.Ic -depth 993bfd12208SRuslan Ermilovwould never be evaluated. 9949b50d902SRodney W. GrimesThis is not the case. 9959b50d902SRodney W. Grimes.Pp 996bfd12208SRuslan ErmilovThe operator 997bfd12208SRuslan Ermilov.Cm -or 998bfd12208SRuslan Ermilovwas implemented as 999bfd12208SRuslan Ermilov.Cm -o , 1000bfd12208SRuslan Ermilovand the operator 1001bfd12208SRuslan Ermilov.Cm -and 1002bfd12208SRuslan Ermilovwas implemented as 1003bfd12208SRuslan Ermilov.Cm -a . 10049b50d902SRodney W. Grimes.Pp 10059b50d902SRodney W. GrimesHistoric implementations of the 1006bfd12208SRuslan Ermilov.Ic -exec 10079b50d902SRodney W. Grimesand 1008bfd12208SRuslan Ermilov.Ic -ok 1009bfd12208SRuslan Ermilovprimaries did not replace the string 1010bfd12208SRuslan Ermilov.Dq Li {} 1011bfd12208SRuslan Ermilovin the utility name or the 10129b50d902SRodney W. Grimesutility arguments if it had preceding or following non-whitespace characters. 10139b50d902SRodney W. GrimesThis version replaces it no matter where in the utility name or arguments 10149b50d902SRodney W. Grimesit appears. 10157c1d4b3aSAkinori MUSHA.Pp 10167c1d4b3aSAkinori MUSHAThe 10177c1d4b3aSAkinori MUSHA.Fl E 101847d91ba3SDag-Erling Smørgravoption was inspired by the equivalent 10197c1d4b3aSAkinori MUSHA.Xr grep 1 10207c1d4b3aSAkinori MUSHAand 102147d91ba3SDag-Erling Smørgrav.Xr sed 1 102247d91ba3SDag-Erling Smørgravoptions. 1023ad487600SColin Percival.Sh HISTORY 1024ad487600SColin PercivalA 1025ad487600SColin Percival.Nm 1026ad487600SColin Percivalcommand appeared in 1027ad487600SColin Percival.At v1 . 10289b50d902SRodney W. Grimes.Sh BUGS 10299b50d902SRodney W. GrimesThe special characters used by 10308fe908efSRuslan Ermilov.Nm 10319b50d902SRodney W. Grimesare also special characters to many shell programs. 1032bfd12208SRuslan ErmilovIn particular, the characters 1033bfd12208SRuslan Ermilov.Dq Li * , 1034bfd12208SRuslan Ermilov.Dq Li \&[ , 1035bfd12208SRuslan Ermilov.Dq Li \&] , 1036bfd12208SRuslan Ermilov.Dq Li \&? , 1037bfd12208SRuslan Ermilov.Dq Li \&( , 1038bfd12208SRuslan Ermilov.Dq Li \&) , 1039bfd12208SRuslan Ermilov.Dq Li \&! , 1040bfd12208SRuslan Ermilov.Dq Li \e 1041bfd12208SRuslan Ermilovand 1042bfd12208SRuslan Ermilov.Dq Li \&; 1043bfd12208SRuslan Ermilovmay have to be escaped from the shell. 10449b50d902SRodney W. Grimes.Pp 10459b50d902SRodney W. GrimesAs there is no delimiter separating options and file names or file 10469b50d902SRodney W. Grimesnames and the 10479b50d902SRodney W. Grimes.Ar expression , 1048bfd12208SRuslan Ermilovit is difficult to specify files named 1049bfd12208SRuslan Ermilov.Pa -xdev 1050bfd12208SRuslan Ermilovor 1051bfd12208SRuslan Ermilov.Pa \&! . 10529b50d902SRodney W. GrimesThese problems are handled by the 10539b50d902SRodney W. Grimes.Fl f 10549b50d902SRodney W. Grimesoption and the 10559b50d902SRodney W. Grimes.Xr getopt 3 1056bfd12208SRuslan Ermilov.Dq Fl Fl 1057bfd12208SRuslan Ermilovconstruct. 1058abacbbbfSPeter Wemm.Pp 1059abacbbbfSPeter WemmThe 1060abacbbbfSPeter Wemm.Ic -delete 106156f7a840SBill Fumerolaprimary does not interact well with other options that cause the file system 1062abacbbbfSPeter Wemmtree traversal options to be changed. 1063ad487600SColin Percival.Pp 10644f45d811STim J. RobbinsThe 1065dfef91e9SColin Percival.Ic -mindepth 1066dfef91e9SColin Percivaland 1067dfef91e9SColin Percival.Ic -maxdepth 10682cb640f6SColin Percivalprimaries are actually global options (as documented above). 10692cb640f6SColin PercivalThey should 1070dfef91e9SColin Percivalprobably be replaced by options which look like options. 1071