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.\" 34*40072dc2SJilles Tjoelker.Dd July 25, 2012 359b50d902SRodney W. Grimes.Dt FIND 1 369b50d902SRodney W. Grimes.Os 379b50d902SRodney W. Grimes.Sh NAME 389b50d902SRodney W. Grimes.Nm find 399b50d902SRodney W. Grimes.Nd walk a file hierarchy 409b50d902SRodney W. Grimes.Sh SYNOPSIS 418fe908efSRuslan Ermilov.Nm 429b50d902SRodney W. Grimes.Op Fl H | Fl L | Fl P 437c1d4b3aSAkinori MUSHA.Op Fl EXdsx 44dfab7fb1SRuslan Ermilov.Op Fl f Ar path 45dfab7fb1SRuslan Ermilov.Ar path ... 46dfab7fb1SRuslan Ermilov.Op Ar expression 47107f86a2SStefan Farfeleder.Nm 48107f86a2SStefan Farfeleder.Op Fl H | Fl L | Fl P 49107f86a2SStefan Farfeleder.Op Fl EXdsx 50dfab7fb1SRuslan Ermilov.Fl f Ar path 51dfab7fb1SRuslan Ermilov.Op Ar path ... 52dfab7fb1SRuslan Ermilov.Op Ar expression 539b50d902SRodney W. Grimes.Sh DESCRIPTION 54e8937ba0SPhilippe CharnierThe 55e8937ba0SPhilippe Charnier.Nm 56e8937ba0SPhilippe Charnierutility recursively descends the directory tree for each 57dfab7fb1SRuslan Ermilov.Ar path 589b50d902SRodney W. Grimeslisted, evaluating an 599b50d902SRodney W. Grimes.Ar expression 60bfd12208SRuslan Ermilov(composed of the 61bfd12208SRuslan Ermilov.Dq primaries 62bfd12208SRuslan Ermilovand 63bfd12208SRuslan Ermilov.Dq operands 64bfd12208SRuslan Ermilovlisted below) in terms 659b50d902SRodney W. Grimesof each file in the tree. 669b50d902SRodney W. Grimes.Pp 679b50d902SRodney W. GrimesThe options are as follows: 68bfd12208SRuslan Ermilov.Bl -tag -width indent 697c1d4b3aSAkinori MUSHA.It Fl E 707c1d4b3aSAkinori MUSHAInterpret regular expressions followed by 717c1d4b3aSAkinori MUSHA.Ic -regex 727c1d4b3aSAkinori MUSHAand 737c1d4b3aSAkinori MUSHA.Ic -iregex 74fbccd9dbSRuslan Ermilovprimaries as extended (modern) regular expressions rather than basic 75bfd12208SRuslan Ermilovregular expressions (BRE's). 76bfd12208SRuslan ErmilovThe 777c1d4b3aSAkinori MUSHA.Xr re_format 7 787c1d4b3aSAkinori MUSHAmanual page fully describes both formats. 799b50d902SRodney W. Grimes.It Fl H 803c94f41fSPhilippe CharnierCause the file information and file type (see 819b50d902SRodney W. Grimes.Xr stat 2 ) 829b50d902SRodney W. Grimesreturned for each symbolic link specified on the command line to be 839b50d902SRodney W. Grimesthose of the file referenced by the link, not the link itself. 849b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will 856df69548SBruce Evansbe for the link itself. 866df69548SBruce EvansFile information of all symbolic links not on 879b50d902SRodney W. Grimesthe command line is that of the link itself. 889b50d902SRodney W. Grimes.It Fl L 893c94f41fSPhilippe CharnierCause the file information and file type (see 909b50d902SRodney W. Grimes.Xr stat 2 ) 919b50d902SRodney W. Grimesreturned for each symbolic link to be those of the file referenced by the 929b50d902SRodney W. Grimeslink, not the link itself. 939b50d902SRodney W. GrimesIf the referenced file does not exist, the file information and type will 949b50d902SRodney W. Grimesbe for the link itself. 9547d91ba3SDag-Erling Smørgrav.Pp 9647d91ba3SDag-Erling SmørgravThis option is equivalent to the deprecated 9747d91ba3SDag-Erling Smørgrav.Ic -follow 9847d91ba3SDag-Erling Smørgravprimary. 999b50d902SRodney W. Grimes.It Fl P 1003c94f41fSPhilippe CharnierCause the file information and file type (see 1019b50d902SRodney W. Grimes.Xr stat 2 ) 1029b50d902SRodney W. Grimesreturned for each symbolic link to be those of the link itself. 1033d9a9402SJohn PolstraThis is the default. 1049b50d902SRodney W. Grimes.It Fl X 1053c94f41fSPhilippe CharnierPermit 1069b50d902SRodney W. Grimes.Nm 1079b50d902SRodney W. Grimesto be safely used in conjunction with 1089b50d902SRodney W. Grimes.Xr xargs 1 . 1099b50d902SRodney W. GrimesIf a file name contains any of the delimiting characters used by 110bfd12208SRuslan Ermilov.Xr xargs 1 , 1119b50d902SRodney W. Grimesa diagnostic message is displayed on standard error, and the file 1129b50d902SRodney W. Grimesis skipped. 113bfd12208SRuslan ErmilovThe delimiting characters include single 114bfd12208SRuslan Ermilov.Pq Dq Li " ' " 115bfd12208SRuslan Ermilovand double 116bfd12208SRuslan Ermilov.Pq Dq Li " \*q " 117bfd12208SRuslan Ermilovquotes, backslash 118bfd12208SRuslan Ermilov.Pq Dq Li \e , 119bfd12208SRuslan Ermilovspace, tab and newline characters. 120a8d50686STom Rhodes.Pp 121a8d50686STom RhodesHowever, you may wish to consider the 122a8d50686STom Rhodes.Fl print0 123a8d50686STom Rhodesprimary in conjunction with 124e2f8ed51SRuslan Ermilov.Dq Nm xargs Fl 0 125a8d50686STom Rhodesas an effective alternative. 1269b50d902SRodney W. Grimes.It Fl d 1273c94f41fSPhilippe CharnierCause 1288fe908efSRuslan Ermilov.Nm 129eb555785SJilles Tjoelkerto perform a depth-first traversal. 13047d91ba3SDag-Erling Smørgrav.Pp 131eb555785SJilles TjoelkerThis option is a BSD-specific equivalent of the 13247d91ba3SDag-Erling Smørgrav.Ic -depth 133eb555785SJilles Tjoelkerprimary specified by 1341c832963SOliver Eikemeier.St -p1003.1-2001 . 135eb555785SJilles TjoelkerRefer to its description under 136eb555785SJilles Tjoelker.Sx PRIMARIES 137eb555785SJilles Tjoelkerfor more information. 1386d0c7e13SWolfram Schneider.It Fl s 1393c94f41fSPhilippe CharnierCause 1408fe908efSRuslan Ermilov.Nm 1416df69548SBruce Evansto traverse the file hierarchies in lexicographical order, 1426df69548SBruce Evansi.e., alphabetical order within each directory. 1436df69548SBruce EvansNote: 144bfd12208SRuslan Ermilov.Ql find -s 1456d0c7e13SWolfram Schneiderand 146bfd12208SRuslan Ermilov.Ql "find | sort" 1476d0c7e13SWolfram Schneidermay give different results. 1489b50d902SRodney W. Grimes.It Fl x 1493c94f41fSPhilippe CharnierPrevent 1508fe908efSRuslan Ermilov.Nm 1519b50d902SRodney W. Grimesfrom descending into directories that have a device number different 1529b50d902SRodney W. Grimesthan that of the file from which the descent began. 15347d91ba3SDag-Erling Smørgrav.Pp 15447d91ba3SDag-Erling SmørgravThis option is equivalent to the deprecated 15547d91ba3SDag-Erling Smørgrav.Ic -xdev 15647d91ba3SDag-Erling Smørgravprimary. 1579b50d902SRodney W. Grimes.El 1589b50d902SRodney W. Grimes.Sh PRIMARIES 159be2cad28SGlen BarberAll primaries which take a numeric argument allow the number to be 160be2cad28SGlen Barberpreceded by a plus sign 161be2cad28SGlen Barber.Pq Dq Li + 162be2cad28SGlen Barberor a minus sign 163be2cad28SGlen Barber.Pq Dq Li - . 164be2cad28SGlen BarberA preceding plus sign means 165be2cad28SGlen Barber.Dq more than n , 166be2cad28SGlen Barbera preceding minus sign means 167be2cad28SGlen Barber.Dq less than n 168be2cad28SGlen Barberand neither means 169be2cad28SGlen Barber.Dq exactly n . 170bfd12208SRuslan Ermilov.Bl -tag -width indent 17131d53425SCeri Davies.It Ic -Bmin Ar n 17231d53425SCeri DaviesTrue if the difference between the time of a file's inode creation 17331d53425SCeri Daviesand the time 17431d53425SCeri Davies.Nm 17531d53425SCeri Davieswas started, rounded up to the next full minute, is 17631d53425SCeri Davies.Ar n 17731d53425SCeri Daviesminutes. 17831d53425SCeri Davies.It Ic -Bnewer Ar file 17931d53425SCeri DaviesSame as 18031d53425SCeri Davies.Ic -newerBm . 18131d53425SCeri Davies.It Ic -Btime Ar n Ns Op Cm smhdw 18231d53425SCeri DaviesIf no units are specified, this primary evaluates to 18331d53425SCeri Daviestrue if the difference between the time of a file's inode creation 18431d53425SCeri Daviesand the time 18531d53425SCeri Davies.Nm 18631d53425SCeri Davieswas started, rounded up to the next full 24-hour period, is 18731d53425SCeri Davies.Ar n 18831d53425SCeri Davies24-hour periods. 18931d53425SCeri Davies.Pp 19031d53425SCeri DaviesIf units are specified, this primary evaluates to 1913b0fbd31SRuslan Ermilovtrue if the difference between the time of a file's inode creation 1923b0fbd31SRuslan Ermilovand the time 19331d53425SCeri Davies.Nm 19431d53425SCeri Davieswas started is exactly 19531d53425SCeri Davies.Ar n 19631d53425SCeri Daviesunits. 19731d53425SCeri DaviesPlease refer to the 19831d53425SCeri Davies.Ic -atime 19931d53425SCeri Daviesprimary description for information on supported time units. 20053e87059STom Rhodes.It Ic -acl 201fbccd9dbSRuslan ErmilovMay be used in conjunction with other primaries to locate 20253e87059STom Rhodesfiles with extended ACLs. 20353e87059STom RhodesSee 20453e87059STom Rhodes.Xr acl 3 20553e87059STom Rhodesfor more information. 2063f5223f8SWolfram Schneider.It Ic -amin Ar n 2073f5223f8SWolfram SchneiderTrue if the difference between the file last access time and the time 2088fe908efSRuslan Ermilov.Nm 20945fe9882SMatthew Huntwas started, rounded up to the next full minute, is 2103f5223f8SWolfram Schneider.Ar n 21145fe9882SMatthew Huntminutes. 212ea92232aSPoul-Henning Kamp.It Ic -anewer Ar file 213ea92232aSPoul-Henning KampSame as 214ea92232aSPoul-Henning Kamp.Ic -neweram . 215adff4fcaSRuslan Ermilov.It Ic -atime Ar n Ns Op Cm smhdw 216adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to 217adff4fcaSRuslan Ermilovtrue if the difference between the file last access time and the time 2188fe908efSRuslan Ermilov.Nm 21954874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is 2209b50d902SRodney W. Grimes.Ar n 22154874bb6SRuslan Ermilov24-hour periods. 222adff4fcaSRuslan Ermilov.Pp 223adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to 224adff4fcaSRuslan Ermilovtrue if the difference between the file last access time and the time 225adff4fcaSRuslan Ermilov.Nm 226adff4fcaSRuslan Ermilovwas started is exactly 227adff4fcaSRuslan Ermilov.Ar n 228adff4fcaSRuslan Ermilovunits. 229adff4fcaSRuslan ErmilovPossible time units are as follows: 230adff4fcaSRuslan Ermilov.Pp 231adff4fcaSRuslan Ermilov.Bl -tag -width indent -compact 232adff4fcaSRuslan Ermilov.It Cm s 233adff4fcaSRuslan Ermilovsecond 234adff4fcaSRuslan Ermilov.It Cm m 235adff4fcaSRuslan Ermilovminute (60 seconds) 236adff4fcaSRuslan Ermilov.It Cm h 237adff4fcaSRuslan Ermilovhour (60 minutes) 238adff4fcaSRuslan Ermilov.It Cm d 239adff4fcaSRuslan Ermilovday (24 hours) 240adff4fcaSRuslan Ermilov.It Cm w 241adff4fcaSRuslan Ermilovweek (7 days) 242adff4fcaSRuslan Ermilov.El 243adff4fcaSRuslan Ermilov.Pp 244adff4fcaSRuslan ErmilovAny number of units may be combined in one 245adff4fcaSRuslan Ermilov.Ic -atime 246adff4fcaSRuslan Ermilovargument, for example, 247adff4fcaSRuslan Ermilov.Dq Li "-atime -1h30m" . 248adff4fcaSRuslan ErmilovUnits are probably only useful when used in conjunction with the 249adff4fcaSRuslan Ermilov.Cm + 250adff4fcaSRuslan Ermilovor 251adff4fcaSRuslan Ermilov.Cm - 252adff4fcaSRuslan Ermilovmodifier. 2533f5223f8SWolfram Schneider.It Ic -cmin Ar n 2543f5223f8SWolfram SchneiderTrue if the difference between the time of last change of file status 2553f5223f8SWolfram Schneiderinformation and the time 2568fe908efSRuslan Ermilov.Nm 25745fe9882SMatthew Huntwas started, rounded up to the next full minute, is 2583f5223f8SWolfram Schneider.Ar n 25945fe9882SMatthew Huntminutes. 260ea92232aSPoul-Henning Kamp.It Ic -cnewer Ar file 261ea92232aSPoul-Henning KampSame as 262ea92232aSPoul-Henning Kamp.Ic -newercm . 263adff4fcaSRuslan Ermilov.It Ic -ctime Ar n Ns Op Cm smhdw 264adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to 265adff4fcaSRuslan Ermilovtrue if the difference between the time of last change of file status 2669b50d902SRodney W. Grimesinformation and the time 2678fe908efSRuslan Ermilov.Nm 26854874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is 2699b50d902SRodney W. Grimes.Ar n 27054874bb6SRuslan Ermilov24-hour periods. 271adff4fcaSRuslan Ermilov.Pp 272adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to 273adff4fcaSRuslan Ermilovtrue if the difference between the time of last change of file status 274adff4fcaSRuslan Ermilovinformation and the time 275adff4fcaSRuslan Ermilov.Nm 276adff4fcaSRuslan Ermilovwas started is exactly 277adff4fcaSRuslan Ermilov.Ar n 278adff4fcaSRuslan Ermilovunits. 279adff4fcaSRuslan ErmilovPlease refer to the 280adff4fcaSRuslan Ermilov.Ic -atime 281adff4fcaSRuslan Ermilovprimary description for information on supported time units. 28246b993ffSWarner Losh.It Ic -d 283a8622446SIsabell LongNon-portable, BSD-specific version of 28446b993ffSWarner Losh.Ic depth . 28546b993ffSWarner LoshGNU find implements this as a primary in mistaken emulation of 28646b993ffSWarner Losh.Fx 28746b993ffSWarner Losh.Xr find 1 . 288abacbbbfSPeter Wemm.It Ic -delete 2896df69548SBruce EvansDelete found files and/or directories. 2906df69548SBruce EvansAlways returns true. 2916df69548SBruce EvansThis executes 292abacbbbfSPeter Wemmfrom the current working directory as 293abacbbbfSPeter Wemm.Nm 2946df69548SBruce Evansrecurses down the tree. 295bfd12208SRuslan ErmilovIt will not attempt to delete a filename with a 296bfd12208SRuslan Ermilov.Dq Pa / 297bfd12208SRuslan Ermilovcharacter in its pathname relative to 298bfd12208SRuslan Ermilov.Dq Pa \&. 299bfd12208SRuslan Ermilovfor security reasons. 30054874bb6SRuslan ErmilovDepth-first traversal processing is implied by this option. 3015102783bSEitan AdlerThe 3025102783bSEitan Adler.Ic -delete 3035102783bSEitan Adlerprimary will fail to delete a directory if it is not empty. 304a05cb852SJilles TjoelkerFollowing symlinks is incompatible with this option. 3059b4e871aSDavid E. O'Brien.It Ic -depth 3069b4e871aSDavid E. O'BrienAlways true; 307a8622446SIsabell Longsame as the non-portable 3089b4e871aSDavid E. O'Brien.Fl d 309eb555785SJilles Tjoelkeroption. 310eb555785SJilles TjoelkerCause 311eb555785SJilles Tjoelker.Nm 312eb555785SJilles Tjoelkerto perform a depth-first traversal, i.e., directories 313eb555785SJilles Tjoelkerare visited in post-order and all entries in a directory will be acted 314eb555785SJilles Tjoelkeron before the directory itself. 315eb555785SJilles TjoelkerBy default, 316eb555785SJilles Tjoelker.Nm 317eb555785SJilles Tjoelkervisits directories in pre-order, i.e., before their contents. 318eb555785SJilles TjoelkerNote, the default is 319eb555785SJilles Tjoelker.Em not 320eb555785SJilles Tjoelkera breadth-first traversal. 321eb555785SJilles Tjoelker.Pp 322eb555785SJilles TjoelkerThe 323eb555785SJilles Tjoelker.Ic -depth 324eb555785SJilles Tjoelkerprimary 325eb555785SJilles Tjoelkercan be useful when 326eb555785SJilles Tjoelker.Nm 327eb555785SJilles Tjoelkeris used with 328eb555785SJilles Tjoelker.Xr cpio 1 329eb555785SJilles Tjoelkerto process files that are contained in directories with unusual permissions. 330eb555785SJilles TjoelkerIt ensures that you have write permission while you are placing files in a 331eb555785SJilles Tjoelkerdirectory, then sets the directory's permissions as the last thing. 3321c832963SOliver Eikemeier.It Ic -depth Ar n 3331c832963SOliver EikemeierTrue if the depth of the file relative to the starting point of the traversal 3341c832963SOliver Eikemeieris 3351c832963SOliver Eikemeier.Ar n . 336ed1a4621SPeter Wemm.It Ic -empty 337ed1a4621SPeter WemmTrue if the current file or directory is empty. 338c93e83feSRuslan Ermilov.It Ic -exec Ar utility Oo Ar argument ... Oc Li \&; 3399b50d902SRodney W. GrimesTrue if the program named 3409b50d902SRodney W. Grimes.Ar utility 3419b50d902SRodney W. Grimesreturns a zero value as its exit status. 342bfd12208SRuslan ErmilovOptional 343bfd12208SRuslan Ermilov.Ar arguments 344bfd12208SRuslan Ermilovmay be passed to the utility. 345bfd12208SRuslan ErmilovThe expression must be terminated by a semicolon 346bfd12208SRuslan Ermilov.Pq Dq Li \&; . 3476a2b59f8SJens SchweikhardtIf you invoke 3486a2b59f8SJens Schweikhardt.Nm 3496a2b59f8SJens Schweikhardtfrom a shell you may need to quote the semicolon if the shell would 3506a2b59f8SJens Schweikhardtotherwise treat it as a control operator. 351bfd12208SRuslan ErmilovIf the string 352bfd12208SRuslan Ermilov.Dq Li {} 353bfd12208SRuslan Ermilovappears anywhere in the utility name or the 3549b50d902SRodney W. Grimesarguments it is replaced by the pathname of the current file. 3559b50d902SRodney W. Grimes.Ar Utility 3569b50d902SRodney W. Grimeswill be executed from the directory from which 3578fe908efSRuslan Ermilov.Nm 3589b50d902SRodney W. Grimeswas executed. 35908274979SYaroslav Tykhiy.Ar Utility 36008274979SYaroslav Tykhiyand 36108274979SYaroslav Tykhiy.Ar arguments 36208274979SYaroslav Tykhiyare not subject to the further expansion of shell patterns 36308274979SYaroslav Tykhiyand constructs. 364c93e83feSRuslan Ermilov.It Ic -exec Ar utility Oo Ar argument ... Oc Li {} + 3655e25d888STim J. RobbinsSame as 3665e25d888STim J. Robbins.Ic -exec , 3675e25d888STim J. Robbinsexcept that 3685e25d888STim J. Robbins.Dq Li {} 3695e25d888STim J. Robbinsis replaced with as many pathnames as possible for each invocation of 3705e25d888STim J. Robbins.Ar utility . 3715e25d888STim J. RobbinsThis behaviour is similar to that of 3725e25d888STim J. Robbins.Xr xargs 1 . 373c93e83feSRuslan Ermilov.It Ic -execdir Ar utility Oo Ar argument ... Oc Li \&; 374127d7563SWarner LoshThe 375bfd12208SRuslan Ermilov.Ic -execdir 376127d7563SWarner Loshprimary is identical to the 377127d7563SWarner Losh.Ic -exec 378127d7563SWarner Loshprimary with the exception that 379bfd12208SRuslan Ermilov.Ar utility 380127d7563SWarner Loshwill be executed from the directory that holds 3816df69548SBruce Evansthe current file. 3826df69548SBruce EvansThe filename substituted for 383bfd12208SRuslan Ermilovthe string 384bfd12208SRuslan Ermilov.Dq Li {} 385bfd12208SRuslan Ermilovis not qualified. 38646b993ffSWarner Losh.It Ic -execdir Ar utility Oo Ar argument ... Oc Li {} + 38746b993ffSWarner LoshSame as 38846b993ffSWarner Losh.Ic -execdir , 38946b993ffSWarner Loshexcept that 39046b993ffSWarner Losh.Dq Li {} 39146b993ffSWarner Loshis replaced with as many pathnames as possible for each invocation of 39246b993ffSWarner Losh.Ar utility . 39346b993ffSWarner LoshThis behaviour is similar to that of 39446b993ffSWarner Losh.Xr xargs 1 . 3957fd5ee41SRuslan Ermilov.It Ic -flags Oo Cm - Ns | Ns Cm + Oc Ns Ar flags , Ns Ar notflags 3967fd5ee41SRuslan ErmilovThe flags are specified using symbolic names (see 397208691fcSRuslan Ermilov.Xr chflags 1 ) . 3987fd5ee41SRuslan ErmilovThose with the 3997fd5ee41SRuslan Ermilov.Qq Li no 4007fd5ee41SRuslan Ermilovprefix (except 4017fd5ee41SRuslan Ermilov.Qq Li nodump ) 4027fd5ee41SRuslan Ermilovare said to be 4037fd5ee41SRuslan Ermilov.Ar notflags . 4047fd5ee41SRuslan ErmilovFlags in 4057fd5ee41SRuslan Ermilov.Ar flags 4067fd5ee41SRuslan Ermilovare checked to be set, and flags in 4077fd5ee41SRuslan Ermilov.Ar notflags 4087fd5ee41SRuslan Ermilovare checked to be not set. 409208691fcSRuslan ErmilovNote that this is different from 410208691fcSRuslan Ermilov.Ic -perm , 4117fd5ee41SRuslan Ermilovwhich only allows the user to specify mode bits that are set. 4127fd5ee41SRuslan Ermilov.Pp 4137fd5ee41SRuslan ErmilovIf flags are preceded by a dash 4147fd5ee41SRuslan Ermilov.Pq Dq Li - , 4157fd5ee41SRuslan Ermilovthis primary evaluates to true 4167fd5ee41SRuslan Ermilovif at least all of the bits in 4177fd5ee41SRuslan Ermilov.Ar flags 4187fd5ee41SRuslan Ermilovand none of the bits in 4197fd5ee41SRuslan Ermilov.Ar notflags 4207fd5ee41SRuslan Ermilovare set in the file's flags bits. 4217fd5ee41SRuslan ErmilovIf flags are preceded by a plus 4227fd5ee41SRuslan Ermilov.Pq Dq Li + , 4237fd5ee41SRuslan Ermilovthis primary evaluates to true 4247fd5ee41SRuslan Ermilovif any of the bits in 4257fd5ee41SRuslan Ermilov.Ar flags 4267fd5ee41SRuslan Ermilovis set in the file's flags bits, 4277fd5ee41SRuslan Ermilovor any of the bits in 4287fd5ee41SRuslan Ermilov.Ar notflags 4297fd5ee41SRuslan Ermilovis not set in the file's flags bits. 4307fd5ee41SRuslan ErmilovOtherwise, 4317fd5ee41SRuslan Ermilovthis primary evaluates to true 4327fd5ee41SRuslan Ermilovif the bits in 4337fd5ee41SRuslan Ermilov.Ar flags 4347fd5ee41SRuslan Ermilovexactly match the file's flags bits, 4357fd5ee41SRuslan Ermilovand none of the 4367fd5ee41SRuslan Ermilov.Ar flags 4377fd5ee41SRuslan Ermilovbits match those of 4387fd5ee41SRuslan Ermilov.Ar notflags . 4399b50d902SRodney W. Grimes.It Ic -fstype Ar type 4409b50d902SRodney W. GrimesTrue if the file is contained in a file system of type 4419b50d902SRodney W. Grimes.Ar type . 442841484cdSPeter WemmThe 443d740b7c7SPawel Jakub Dawidek.Xr lsvfs 1 444841484cdSPeter Wemmcommand can be used to find out the types of file systems 445d740b7c7SPawel Jakub Dawidekthat are available on the system. 446bfd12208SRuslan ErmilovIn addition, there are two pseudo-types, 447bfd12208SRuslan Ermilov.Dq Li local 448bfd12208SRuslan Ermilovand 449bfd12208SRuslan Ermilov.Dq Li rdonly . 4509b50d902SRodney W. GrimesThe former matches any file system physically mounted on the system where 4519b50d902SRodney W. Grimesthe 4528fe908efSRuslan Ermilov.Nm 4539b50d902SRodney W. Grimesis being executed and the latter matches any file system which is 4549b50d902SRodney W. Grimesmounted read-only. 45546b993ffSWarner Losh.It Ic -gid Ar gname 45646b993ffSWarner LoshThe same thing as 45746b993ffSWarner Losh.Ar -group Ar gname 45846b993ffSWarner Loshfor compatibility with GNU find. 45946b993ffSWarner LoshGNU find imposes a restriction that 46046b993ffSWarner Losh.Ar gname 46146b993ffSWarner Loshis numeric, while 46246b993ffSWarner Losh.Xr find 1 46346b993ffSWarner Loshdoes not. 4649b50d902SRodney W. Grimes.It Ic -group Ar gname 4659b50d902SRodney W. GrimesTrue if the file belongs to the group 4669b50d902SRodney W. Grimes.Ar gname . 4679b50d902SRodney W. GrimesIf 4689b50d902SRodney W. Grimes.Ar gname 4699b50d902SRodney W. Grimesis numeric and there is no such group name, then 4709b50d902SRodney W. Grimes.Ar gname 471bfd12208SRuslan Ermilovis treated as a group ID. 47246b993ffSWarner Losh.It Ic -ignore_readdir_race 473*40072dc2SJilles TjoelkerIgnore errors because a file or a directory is deleted 474*40072dc2SJilles Tjoelkerafter reading the name from a directory. 475*40072dc2SJilles TjoelkerThis option does not affect errors occurring on starting points. 47646b993ffSWarner Losh.It Ic -ilname Ar pattern 47746b993ffSWarner LoshLike 47846b993ffSWarner Losh.Ic -lname , 47946b993ffSWarner Loshbut the match is case insensitive. 480a66a6a2aSWarner LoshThis is a GNU find extension. 481208691fcSRuslan Ermilov.It Ic -iname Ar pattern 482208691fcSRuslan ErmilovLike 483208691fcSRuslan Ermilov.Ic -name , 484208691fcSRuslan Ermilovbut the match is case insensitive. 4859b50d902SRodney W. Grimes.It Ic -inum Ar n 4869b50d902SRodney W. GrimesTrue if the file has inode number 4879b50d902SRodney W. Grimes.Ar n . 488208691fcSRuslan Ermilov.It Ic -ipath Ar pattern 489208691fcSRuslan ErmilovLike 490208691fcSRuslan Ermilov.Ic -path , 491208691fcSRuslan Ermilovbut the match is case insensitive. 492208691fcSRuslan Ermilov.It Ic -iregex Ar pattern 493208691fcSRuslan ErmilovLike 494208691fcSRuslan Ermilov.Ic -regex , 495208691fcSRuslan Ermilovbut the match is case insensitive. 49646b993ffSWarner Losh.It Ic -iwholename Ar pattern 49746b993ffSWarner LoshThe same thing as 49846b993ffSWarner Losh.Ic -ipath , 49946b993ffSWarner Loshfor GNU find compatibility. 5009b50d902SRodney W. Grimes.It Ic -links Ar n 5019b50d902SRodney W. GrimesTrue if the file has 5029b50d902SRodney W. Grimes.Ar n 5039b50d902SRodney W. Grimeslinks. 50446b993ffSWarner Losh.It Ic -lname Ar pattern 50546b993ffSWarner LoshLike 50646b993ffSWarner Losh.Ic -name , 507a66a6a2aSWarner Loshbut the contents of the symbolic link are matched instead of the file 508a66a6a2aSWarner Loshname. 509a66a6a2aSWarner LoshThis is a GNU find extension. 5109b50d902SRodney W. Grimes.It Ic -ls 5119b50d902SRodney W. GrimesThis primary always evaluates to true. 5129b50d902SRodney W. GrimesThe following information for the current file is written to standard output: 51354874bb6SRuslan Ermilovits inode number, size in 512-byte blocks, file permissions, number of hard 5149b50d902SRodney W. Grimeslinks, owner, group, size in bytes, last modification time, and pathname. 5159f365aa1SEd SchoutenIf the file is a block or character special file, the device number 5169b50d902SRodney W. Grimeswill be displayed instead of the size in bytes. 51754874bb6SRuslan ErmilovIf the file is a symbolic link, the pathname of the linked-to file will be 518bfd12208SRuslan Ermilovdisplayed preceded by 519bfd12208SRuslan Ermilov.Dq Li -> . 520bfd12208SRuslan ErmilovThe format is identical to that produced by 521bfd12208SRuslan Ermilov.Bk -words 522fbccd9dbSRuslan Ermilov.Dq Nm ls Fl dgils . 523bfd12208SRuslan Ermilov.Ek 524c76bc8f3SOllivier Robert.It Ic -maxdepth Ar n 5259c61111dSOliver EikemeierAlways true; descend at most 5269c61111dSOliver Eikemeier.Ar n 5279c61111dSOliver Eikemeierdirectory levels below the command line arguments. 528d79829afSOliver EikemeierIf any 529d79829afSOliver Eikemeier.Ic -maxdepth 530d79829afSOliver Eikemeierprimary is specified, it applies to the entire expression even if it would 531d79829afSOliver Eikemeiernot normally be evaluated. 532fbccd9dbSRuslan Ermilov.Dq Ic -maxdepth Li 0 533d79829afSOliver Eikemeierlimits the whole search to the command line arguments. 534c76bc8f3SOllivier Robert.It Ic -mindepth Ar n 5359c61111dSOliver EikemeierAlways true; do not apply any tests or actions at levels less than 5369c61111dSOliver Eikemeier.Ar n . 537d79829afSOliver EikemeierIf any 538d79829afSOliver Eikemeier.Ic -mindepth 539d79829afSOliver Eikemeierprimary is specified, it applies to the entire expression even if it would 540d79829afSOliver Eikemeiernot normally be evaluated. 541fbccd9dbSRuslan Ermilov.Dq Ic -mindepth Li 1 542d79829afSOliver Eikemeierprocesses all but the command line arguments. 5433f5223f8SWolfram Schneider.It Ic -mmin Ar n 5443f5223f8SWolfram SchneiderTrue if the difference between the file last modification time and the time 5458fe908efSRuslan Ermilov.Nm 54645fe9882SMatthew Huntwas started, rounded up to the next full minute, is 5473f5223f8SWolfram Schneider.Ar n 54845fe9882SMatthew Huntminutes. 549208691fcSRuslan Ermilov.It Ic -mnewer Ar file 550208691fcSRuslan ErmilovSame as 551208691fcSRuslan Ermilov.Ic -newer . 55246b993ffSWarner Losh.It Ic -mount 55346b993ffSWarner LoshThe same thing as 55446b993ffSWarner Losh.Ic -xdev , 55546b993ffSWarner Loshfor GNU find compatibility. 556adff4fcaSRuslan Ermilov.It Ic -mtime Ar n Ns Op Cm smhdw 557adff4fcaSRuslan ErmilovIf no units are specified, this primary evaluates to 558adff4fcaSRuslan Ermilovtrue if the difference between the file last modification time and the time 5598fe908efSRuslan Ermilov.Nm 56054874bb6SRuslan Ermilovwas started, rounded up to the next full 24-hour period, is 5619b50d902SRodney W. Grimes.Ar n 56254874bb6SRuslan Ermilov24-hour periods. 563adff4fcaSRuslan Ermilov.Pp 564adff4fcaSRuslan ErmilovIf units are specified, this primary evaluates to 565adff4fcaSRuslan Ermilovtrue if the difference between the file last modification time and the time 566adff4fcaSRuslan Ermilov.Nm 567adff4fcaSRuslan Ermilovwas started is exactly 568adff4fcaSRuslan Ermilov.Ar n 569adff4fcaSRuslan Ermilovunits. 570adff4fcaSRuslan ErmilovPlease refer to the 571adff4fcaSRuslan Ermilov.Ic -atime 572adff4fcaSRuslan Ermilovprimary description for information on supported time units. 5739b50d902SRodney W. Grimes.It Ic -name Ar pattern 5749b50d902SRodney W. GrimesTrue if the last component of the pathname being examined matches 5759b50d902SRodney W. Grimes.Ar pattern . 576bfd12208SRuslan ErmilovSpecial shell pattern matching characters 577bfd12208SRuslan Ermilov.Dq ( Li \&[ , 578bfd12208SRuslan Ermilov.Dq Li \&] , 579bfd12208SRuslan Ermilov.Dq Li * , 580bfd12208SRuslan Ermilovand 581bfd12208SRuslan Ermilov.Dq Li \&? ) 5829b50d902SRodney W. Grimesmay be used as part of 5839b50d902SRodney W. Grimes.Ar pattern . 5849b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a 585bfd12208SRuslan Ermilovbackslash 586bfd12208SRuslan Ermilov.Pq Dq Li \e . 5879b50d902SRodney W. Grimes.It Ic -newer Ar file 5889b50d902SRodney W. GrimesTrue if the current file has a more recent last modification time than 5899b50d902SRodney W. Grimes.Ar file . 590bfd12208SRuslan Ermilov.It Ic -newer Ns Ar X Ns Ar Y Ar file 591bfd12208SRuslan ErmilovTrue if the current file has a more recent last access time 592fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm a , 59331d53425SCeri Daviesinode creation time 594fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm B , 595bfd12208SRuslan Ermilovchange time 596fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm c , 597bfd12208SRuslan Ermilovor modification time 598fbccd9dbSRuslan Ermilov.Pq Ar X Ns = Ns Cm m 599bfd12208SRuslan Ermilovthan the last access time 600fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm a , 60131d53425SCeri Daviesinode creation time 602fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm B , 603bfd12208SRuslan Ermilovchange time 604fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm c , 605bfd12208SRuslan Ermilovor modification time 606fbccd9dbSRuslan Ermilov.Pq Ar Y Ns = Ns Cm m 607bfd12208SRuslan Ermilovof 608ea92232aSPoul-Henning Kamp.Ar file . 609ea92232aSPoul-Henning KampIn addition, if 610bfd12208SRuslan Ermilov.Ar Y Ns = Ns Cm t , 611ea92232aSPoul-Henning Kampthen 612ea92232aSPoul-Henning Kamp.Ar file 613ea92232aSPoul-Henning Kampis instead interpreted as a direct date specification of the form 614ea92232aSPoul-Henning Kampunderstood by 615ea92232aSPoul-Henning Kamp.Xr cvs 1 . 616ea92232aSPoul-Henning KampNote that 617ea92232aSPoul-Henning Kamp.Ic -newermm 618ea92232aSPoul-Henning Kampis equivalent to 619ea92232aSPoul-Henning Kamp.Ic -newer . 6209b50d902SRodney W. Grimes.It Ic -nogroup 6219b50d902SRodney W. GrimesTrue if the file belongs to an unknown group. 62246b993ffSWarner Losh.It Ic -noignore_readdir_race 623*40072dc2SJilles TjoelkerTurn off the effect of 624*40072dc2SJilles Tjoelker.Ic -ignore_readdir_race . 625*40072dc2SJilles TjoelkerThis is default behaviour. 62646b993ffSWarner Losh.It Ic -noleaf 62746b993ffSWarner LoshThis option is for GNU find compatibility. 62846b993ffSWarner LoshIn GNU find it disables an optimization not relevant to 62946b993ffSWarner Losh.Xr find 1 , 63046b993ffSWarner Loshso it is ignored. 631208691fcSRuslan Ermilov.It Ic -nouser 632208691fcSRuslan ErmilovTrue if the file belongs to an unknown user. 633c93e83feSRuslan Ermilov.It Ic -ok Ar utility Oo Ar argument ... Oc Li \&; 634208691fcSRuslan ErmilovThe 635208691fcSRuslan Ermilov.Ic -ok 636208691fcSRuslan Ermilovprimary is identical to the 637208691fcSRuslan Ermilov.Ic -exec 638208691fcSRuslan Ermilovprimary with the exception that 639208691fcSRuslan Ermilov.Nm 640208691fcSRuslan Ermilovrequests user affirmation for the execution of the 641208691fcSRuslan Ermilov.Ar utility 642208691fcSRuslan Ermilovby printing 643208691fcSRuslan Ermilova message to the terminal and reading a response. 64439c59153SRuslan ErmilovIf the response is not affirmative 64539c59153SRuslan Ermilov.Ql ( y 646ef6c7764STim J. Robbinsin the 647ef6c7764STim J. Robbins.Dq Li POSIX 648ef6c7764STim J. Robbinslocale), 649208691fcSRuslan Ermilovthe command is not executed and the 650208691fcSRuslan Ermilovvalue of the 651208691fcSRuslan Ermilov.Ic -ok 652208691fcSRuslan Ermilovexpression is false. 653c93e83feSRuslan Ermilov.It Ic -okdir Ar utility Oo Ar argument ... Oc Li \&; 654208691fcSRuslan ErmilovThe 655208691fcSRuslan Ermilov.Ic -okdir 656208691fcSRuslan Ermilovprimary is identical to the 657208691fcSRuslan Ermilov.Ic -execdir 658208691fcSRuslan Ermilovprimary with the same exception as described for the 659208691fcSRuslan Ermilov.Ic -ok 660208691fcSRuslan Ermilovprimary. 6619b50d902SRodney W. Grimes.It Ic -path Ar pattern 6629b50d902SRodney W. GrimesTrue if the pathname being examined matches 6639b50d902SRodney W. Grimes.Ar pattern . 664bfd12208SRuslan ErmilovSpecial shell pattern matching characters 665bfd12208SRuslan Ermilov.Dq ( Li \&[ , 666bfd12208SRuslan Ermilov.Dq Li \&] , 667bfd12208SRuslan Ermilov.Dq Li * , 668bfd12208SRuslan Ermilovand 669bfd12208SRuslan Ermilov.Dq Li \&? ) 6709b50d902SRodney W. Grimesmay be used as part of 6719b50d902SRodney W. Grimes.Ar pattern . 6729b50d902SRodney W. GrimesThese characters may be matched explicitly by escaping them with a 673bfd12208SRuslan Ermilovbackslash 674bfd12208SRuslan Ermilov.Pq Dq Li \e . 675bfd12208SRuslan ErmilovSlashes 676bfd12208SRuslan Ermilov.Pq Dq Li / 677bfd12208SRuslan Ermilovare treated as normal characters and do not have to be 6789b50d902SRodney W. Grimesmatched explicitly. 6797fd5ee41SRuslan Ermilov.It Ic -perm Oo Cm - Ns | Ns Cm + Oc Ns Ar mode 6809b50d902SRodney W. GrimesThe 6819b50d902SRodney W. Grimes.Ar mode 6829b50d902SRodney W. Grimesmay be either symbolic (see 6839b50d902SRodney W. Grimes.Xr chmod 1 ) 6849b50d902SRodney W. Grimesor an octal number. 6857fd5ee41SRuslan ErmilovIf the 6867fd5ee41SRuslan Ermilov.Ar mode 6877fd5ee41SRuslan Ermilovis symbolic, a starting value of zero is assumed and the 6887fd5ee41SRuslan Ermilov.Ar mode 6897fd5ee41SRuslan Ermilovsets or clears permissions without regard to the process' file mode 6909b50d902SRodney W. Grimescreation mask. 6917fd5ee41SRuslan ErmilovIf the 6927fd5ee41SRuslan Ermilov.Ar mode 6937fd5ee41SRuslan Ermilovis octal, only bits 07777 694bfd12208SRuslan Ermilov.Pq Dv S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO 6959b50d902SRodney W. Grimesof the file's mode bits participate 6969b50d902SRodney W. Grimesin the comparison. 6977fd5ee41SRuslan ErmilovIf the 6987fd5ee41SRuslan Ermilov.Ar mode 6997fd5ee41SRuslan Ermilovis preceded by a dash 700bfd12208SRuslan Ermilov.Pq Dq Li - , 7019b88faecSRuslan Ermilovthis primary evaluates to true 7027fd5ee41SRuslan Ermilovif at least all of the bits in the 7037fd5ee41SRuslan Ermilov.Ar mode 7047fd5ee41SRuslan Ermilovare set in the file's mode bits. 7057fd5ee41SRuslan ErmilovIf the 7067fd5ee41SRuslan Ermilov.Ar mode 7077fd5ee41SRuslan Ermilovis preceded by a plus 708bfd12208SRuslan Ermilov.Pq Dq Li + , 7099b88faecSRuslan Ermilovthis primary evaluates to true 7107fd5ee41SRuslan Ermilovif any of the bits in the 7117fd5ee41SRuslan Ermilov.Ar mode 7127fd5ee41SRuslan Ermilovare set in the file's mode bits. 7139d2796c3SOllivier RobertOtherwise, this primary evaluates to true if 7147fd5ee41SRuslan Ermilovthe bits in the 7157fd5ee41SRuslan Ermilov.Ar mode 7167fd5ee41SRuslan Ermilovexactly match the file's mode bits. 717bfd12208SRuslan ErmilovNote, the first character of a symbolic mode may not be a dash 718bfd12208SRuslan Ermilov.Pq Dq Li - . 7199b50d902SRodney W. Grimes.It Ic -print 7209b50d902SRodney W. GrimesThis primary always evaluates to true. 7219b50d902SRodney W. GrimesIt prints the pathname of the current file to standard output. 722841484cdSPeter WemmIf none of 723bfd12208SRuslan Ermilov.Ic -exec , -ls , -print0 , 7249b50d902SRodney W. Grimesor 725bfd12208SRuslan Ermilov.Ic -ok 726841484cdSPeter Wemmis specified, the given expression shall be effectively replaced by 727bfd12208SRuslan Ermilov.Cm \&( Ar "given expression" Cm \&) Ic -print . 7287cd23434SGarrett Wollman.It Ic -print0 7297cd23434SGarrett WollmanThis primary always evaluates to true. 730fbe0d04aSMasafumi Max NAKANEIt prints the pathname of the current file to standard output, followed by an 731cb29445aSRuslan Ermilov.Tn ASCII 732cb29445aSRuslan Ermilov.Dv NUL 7337cd23434SGarrett Wollmancharacter (character code 0). 7349b50d902SRodney W. Grimes.It Ic -prune 7359b50d902SRodney W. GrimesThis primary always evaluates to true. 7369b50d902SRodney W. GrimesIt causes 7378fe908efSRuslan Ermilov.Nm 7389b50d902SRodney W. Grimesto not descend into the current file. 7399b50d902SRodney W. GrimesNote, the 7409b50d902SRodney W. Grimes.Ic -prune 7419b50d902SRodney W. Grimesprimary has no effect if the 7429b50d902SRodney W. Grimes.Fl d 7439b50d902SRodney W. Grimesoption was specified. 744208691fcSRuslan Ermilov.It Ic -regex Ar pattern 745208691fcSRuslan ErmilovTrue if the whole path of the file matches 746208691fcSRuslan Ermilov.Ar pattern 747208691fcSRuslan Ermilovusing regular expression. 748208691fcSRuslan ErmilovTo match a file named 749208691fcSRuslan Ermilov.Dq Pa ./foo/xyzzy , 750208691fcSRuslan Ermilovyou can use the regular expression 751208691fcSRuslan Ermilov.Dq Li ".*/[xyz]*" 752208691fcSRuslan Ermilovor 753208691fcSRuslan Ermilov.Dq Li ".*/foo/.*" , 754208691fcSRuslan Ermilovbut not 755208691fcSRuslan Ermilov.Dq Li xyzzy 756208691fcSRuslan Ermilovor 757208691fcSRuslan Ermilov.Dq Li /foo/ . 75846b993ffSWarner Losh.It Ic -samefile Ar name 75946b993ffSWarner LoshTrue if the file is a hard link to 76046b993ffSWarner Losh.Ar name . 76146b993ffSWarner LoshIf the command option 76246b993ffSWarner Losh.Ic -L 76346b993ffSWarner Loshis specified, it is also true if the file is a symbolic link and 76446b993ffSWarner Loshpoints to 76546b993ffSWarner Losh.Ar name . 7665a890aacSKirill Ponomarev.It Ic -size Ar n Ns Op Cm ckMGTP 76754874bb6SRuslan ErmilovTrue if the file's size, rounded up, in 512-byte blocks is 7689b50d902SRodney W. Grimes.Ar n . 7699b50d902SRodney W. GrimesIf 7709b50d902SRodney W. Grimes.Ar n 771bfd12208SRuslan Ermilovis followed by a 772bfd12208SRuslan Ermilov.Cm c , 773bfd12208SRuslan Ermilovthen the primary is true if the 7749b50d902SRodney W. Grimesfile's size is 7759b50d902SRodney W. Grimes.Ar n 776bfd12208SRuslan Ermilovbytes (characters). 7775a890aacSKirill PonomarevSimilarly if 7785a890aacSKirill Ponomarev.Ar n 7795a890aacSKirill Ponomarevis followed by a scale indicator then the file's size is compared to 7805a890aacSKirill Ponomarev.Ar n 7815a890aacSKirill Ponomarevscaled as: 7825a890aacSKirill Ponomarev.Pp 7835a890aacSKirill Ponomarev.Bl -tag -width indent -compact 7845a890aacSKirill Ponomarev.It Cm k 7855a890aacSKirill Ponomarevkilobytes (1024 bytes) 7865a890aacSKirill Ponomarev.It Cm M 7875a890aacSKirill Ponomarevmegabytes (1024 kilobytes) 7885a890aacSKirill Ponomarev.It Cm G 7895a890aacSKirill Ponomarevgigabytes (1024 megabytes) 7905a890aacSKirill Ponomarev.It Cm T 7915a890aacSKirill Ponomarevterabytes (1024 gigabytes) 7925a890aacSKirill Ponomarev.It Cm P 7935a890aacSKirill Ponomarevpetabytes (1024 terabytes) 7945a890aacSKirill Ponomarev.El 7959b50d902SRodney W. Grimes.It Ic -type Ar t 7969b50d902SRodney W. GrimesTrue if the file is of the specified type. 7979b50d902SRodney W. GrimesPossible file types are as follows: 7989b50d902SRodney W. Grimes.Pp 799bfd12208SRuslan Ermilov.Bl -tag -width indent -compact 8009b50d902SRodney W. Grimes.It Cm b 8019b50d902SRodney W. Grimesblock special 8029b50d902SRodney W. Grimes.It Cm c 8039b50d902SRodney W. Grimescharacter special 8049b50d902SRodney W. Grimes.It Cm d 8059b50d902SRodney W. Grimesdirectory 8069b50d902SRodney W. Grimes.It Cm f 8079b50d902SRodney W. Grimesregular file 8089b50d902SRodney W. Grimes.It Cm l 8099b50d902SRodney W. Grimessymbolic link 8109b50d902SRodney W. Grimes.It Cm p 8119b50d902SRodney W. GrimesFIFO 8129b50d902SRodney W. Grimes.It Cm s 8139b50d902SRodney W. Grimessocket 8149b50d902SRodney W. Grimes.El 81546b993ffSWarner Losh.It Ic -uid Ar uname 81646b993ffSWarner LoshThe same thing as 81746b993ffSWarner Losh.Ar -user Ar uname 81846b993ffSWarner Loshfor compatibility with GNU find. 81946b993ffSWarner LoshGNU find imposes a restriction that 82046b993ffSWarner Losh.Ar uname 82146b993ffSWarner Loshis numeric, while 82246b993ffSWarner Losh.Xr find 1 82346b993ffSWarner Loshdoes not. 8249b50d902SRodney W. Grimes.It Ic -user Ar uname 8259b50d902SRodney W. GrimesTrue if the file belongs to the user 8269b50d902SRodney W. Grimes.Ar uname . 8279b50d902SRodney W. GrimesIf 8289b50d902SRodney W. Grimes.Ar uname 8299b50d902SRodney W. Grimesis numeric and there is no such user name, then 8309b50d902SRodney W. Grimes.Ar uname 831bfd12208SRuslan Ermilovis treated as a user ID. 83246b993ffSWarner Losh.It Ic -wholename Ar pattern 83346b993ffSWarner LoshThe same thing as 83446b993ffSWarner Losh.Ic -path , 83546b993ffSWarner Loshfor GNU find compatibility. 8369b50d902SRodney W. Grimes.El 8379b50d902SRodney W. Grimes.Sh OPERATORS 8389b50d902SRodney W. GrimesThe primaries may be combined using the following operators. 8399b50d902SRodney W. GrimesThe operators are listed in order of decreasing precedence. 840bfd12208SRuslan Ermilov.Pp 841fbccd9dbSRuslan Ermilov.Bl -tag -width indent -compact 8420c101fb2SJoseph Koshy.It Cm \&( Ar expression Cm \&) 8439b50d902SRodney W. GrimesThis evaluates to true if the parenthesized expression evaluates to 8449b50d902SRodney W. Grimestrue. 8459b50d902SRodney W. Grimes.Pp 8460c101fb2SJoseph Koshy.It Cm \&! Ar expression 8474a0193d3SJuli Mallett.It Cm -not Ar expression 8489b50d902SRodney W. GrimesThis is the unary 8499b50d902SRodney W. Grimes.Tn NOT 8509b50d902SRodney W. Grimesoperator. 8519b50d902SRodney W. GrimesIt evaluates to true if the expression is false. 8529b50d902SRodney W. Grimes.Pp 85346b993ffSWarner Losh.It Cm -false 85446b993ffSWarner LoshAlways false. 85546b993ffSWarner Losh.It Cm -true 85646b993ffSWarner LoshAlways true. 85746b993ffSWarner Losh.Pp 8589b50d902SRodney W. Grimes.It Ar expression Cm -and Ar expression 8599b50d902SRodney W. Grimes.It Ar expression expression 8609b50d902SRodney W. GrimesThe 8619b50d902SRodney W. Grimes.Cm -and 8629b50d902SRodney W. Grimesoperator is the logical 8639b50d902SRodney W. Grimes.Tn AND 8649b50d902SRodney W. Grimesoperator. 8659b50d902SRodney W. GrimesAs it is implied by the juxtaposition of two expressions it does not 8669b50d902SRodney W. Grimeshave to be specified. 8679b50d902SRodney W. GrimesThe expression evaluates to true if both expressions are true. 8689b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is false. 8699b50d902SRodney W. Grimes.Pp 8709b50d902SRodney W. Grimes.It Ar expression Cm -or Ar expression 8719b50d902SRodney W. GrimesThe 8729b50d902SRodney W. Grimes.Cm -or 8739b50d902SRodney W. Grimesoperator is the logical 8749b50d902SRodney W. Grimes.Tn OR 8759b50d902SRodney W. Grimesoperator. 8769b50d902SRodney W. GrimesThe expression evaluates to true if either the first or the second expression 8779b50d902SRodney W. Grimesis true. 8789b50d902SRodney W. GrimesThe second expression is not evaluated if the first expression is true. 8799b50d902SRodney W. Grimes.El 8809b50d902SRodney W. Grimes.Pp 8819b50d902SRodney W. GrimesAll operands and primaries must be separate arguments to 8828fe908efSRuslan Ermilov.Nm . 8839b50d902SRodney W. GrimesPrimaries which themselves take arguments expect each argument 8849b50d902SRodney W. Grimesto be a separate argument to 8858fe908efSRuslan Ermilov.Nm . 886ef6c7764STim J. Robbins.Sh ENVIRONMENT 887ef6c7764STim J. RobbinsThe 888ef6c7764STim J. Robbins.Ev LANG , LC_ALL , LC_COLLATE , LC_CTYPE , LC_MESSAGES 889ef6c7764STim J. Robbinsand 890ef6c7764STim J. Robbins.Ev LC_TIME 891ef6c7764STim J. Robbinsenvironment variables affect the execution of the 892ef6c7764STim J. Robbins.Nm 893ef6c7764STim J. Robbinsutility as described in 894ef6c7764STim J. Robbins.Xr environ 7 . 8959b50d902SRodney W. Grimes.Sh EXAMPLES 8969b50d902SRodney W. GrimesThe following examples are shown as given to the shell: 897bfd12208SRuslan Ermilov.Bl -tag -width indent 8989b50d902SRodney W. Grimes.It Li "find / \e! -name \*q*.c\*q -print" 899bfd12208SRuslan ErmilovPrint out a list of all the files whose names do not end in 900bfd12208SRuslan Ermilov.Pa .c . 9019b50d902SRodney W. Grimes.It Li "find / -newer ttt -user wnj -print" 902bfd12208SRuslan ErmilovPrint out a list of all the files owned by user 903bfd12208SRuslan Ermilov.Dq wnj 904bfd12208SRuslan Ermilovthat are newer 905bfd12208SRuslan Ermilovthan the file 906bfd12208SRuslan Ermilov.Pa ttt . 9079b50d902SRodney W. Grimes.It Li "find / \e! \e( -newer ttt -user wnj \e) -print" 908bfd12208SRuslan ErmilovPrint out a list of all the files which are not both newer than 909bfd12208SRuslan Ermilov.Pa ttt 910bfd12208SRuslan Ermilovand owned by 911bfd12208SRuslan Ermilov.Dq wnj . 9129b50d902SRodney W. Grimes.It Li "find / \e( -newer ttt -or -user wnj \e) -print" 913bfd12208SRuslan ErmilovPrint out a list of all the files that are either owned by 914bfd12208SRuslan Ermilov.Dq wnj 915bfd12208SRuslan Ermilovor that are newer than 916bfd12208SRuslan Ermilov.Pa ttt . 917e578c242STom Rhodes.It Li "find / -newerct '1 minute ago' -print" 918ea92232aSPoul-Henning KampPrint out a list of all the files whose inode change time is more 919ea92232aSPoul-Henning Kamprecent than the current time minus one minute. 92054874bb6SRuslan Ermilov.It Li "find / -type f -exec echo {} \e;" 921e578c242STom RhodesUse the 922e578c242STom Rhodes.Xr echo 1 923e578c242STom Rhodescommand to print out a list of all the files. 924a05cb852SJilles Tjoelker.It Li "find -L /usr/ports/packages -type l -exec rm -- {} +" 9251c832963SOliver EikemeierDelete all broken symbolic links in 9261c832963SOliver Eikemeier.Pa /usr/ports/packages . 9271c832963SOliver Eikemeier.It Li "find /usr/src -name CVS -prune -o -depth +6 -print" 9281c832963SOliver EikemeierFind files and directories that are at least seven levels deep 9291c832963SOliver Eikemeierin the working directory 9301c832963SOliver Eikemeier.Pa /usr/src . 9311c832963SOliver Eikemeier.It Li "find /usr/src -name CVS -prune -o -mindepth 7 -print" 9321c832963SOliver EikemeierIs not equivalent to the previous example, since 9331c832963SOliver Eikemeier.Ic -prune 9341c832963SOliver Eikemeieris not evaluated below level seven. 9359b50d902SRodney W. Grimes.El 936e578c242STom Rhodes.Sh COMPATIBILITY 937e578c242STom RhodesThe 938e578c242STom Rhodes.Ic -follow 93947d91ba3SDag-Erling Smørgravprimary is deprecated; the 94047d91ba3SDag-Erling Smørgrav.Fl L 94147d91ba3SDag-Erling Smørgravoption should be used instead. 94247d91ba3SDag-Erling SmørgravSee the 94347d91ba3SDag-Erling Smørgrav.Sx STANDARDS 94447d91ba3SDag-Erling Smørgravsection below for details. 9459b50d902SRodney W. Grimes.Sh SEE ALSO 946567664c4SOllivier Robert.Xr chflags 1 , 9479b50d902SRodney W. Grimes.Xr chmod 1 , 948ea92232aSPoul-Henning Kamp.Xr cvs 1 , 9499b50d902SRodney W. Grimes.Xr locate 1 , 950d740b7c7SPawel Jakub Dawidek.Xr lsvfs 1 , 95141cbb624SJoseph Koshy.Xr whereis 1 , 95241cbb624SJoseph Koshy.Xr which 1 , 953a8d50686STom Rhodes.Xr xargs 1 , 9549b50d902SRodney W. Grimes.Xr stat 2 , 95553e87059STom Rhodes.Xr acl 3 , 9569b50d902SRodney W. Grimes.Xr fts 3 , 9579b50d902SRodney W. Grimes.Xr getgrent 3 , 9589b50d902SRodney W. Grimes.Xr getpwent 3 , 9599b50d902SRodney W. Grimes.Xr strmode 3 , 96094ad6032SRuslan Ermilov.Xr re_format 7 , 9619b50d902SRodney W. Grimes.Xr symlink 7 9629b50d902SRodney W. Grimes.Sh STANDARDS 9639b50d902SRodney W. GrimesThe 9648fe908efSRuslan Ermilov.Nm 9659b50d902SRodney W. Grimesutility syntax is a superset of the syntax specified by the 9661c832963SOliver Eikemeier.St -p1003.1-2001 9679b50d902SRodney W. Grimesstandard. 9689b50d902SRodney W. Grimes.Pp 9691c832963SOliver EikemeierAll the single character options except 970fbccd9dbSRuslan Ermilov.Fl H 9711c832963SOliver Eikemeierand 972fbccd9dbSRuslan Ermilov.Fl L 973659a728eSCeri Daviesas well as 974659a728eSCeri Davies.Ic -amin , -anewer , -cmin , -cnewer , -delete , -empty , -fstype , 975659a728eSCeri Davies.Ic -iname , -inum , -iregex , -ls , -maxdepth , -mindepth , -mmin , 976659a728eSCeri Davies.Ic -path , -print0 , -regex 977440a24d8SCeri Daviesand all of the 978fbccd9dbSRuslan Ermilov.Ic -B* 979440a24d8SCeri Daviesbirthtime related primaries are extensions to 9801c832963SOliver Eikemeier.St -p1003.1-2001 . 981f6e4fb22SSteve Price.Pp 9829b50d902SRodney W. GrimesHistorically, the 98347d91ba3SDag-Erling Smørgrav.Fl d , L 9849b50d902SRodney W. Grimesand 9859b50d902SRodney W. Grimes.Fl x 986bfd12208SRuslan Ermilovoptions were implemented using the primaries 987bfd12208SRuslan Ermilov.Ic -depth , -follow , 988bfd12208SRuslan Ermilovand 989bfd12208SRuslan Ermilov.Ic -xdev . 9909b50d902SRodney W. GrimesThese primaries always evaluated to true. 9919b50d902SRodney W. GrimesAs they were really global variables that took effect before the traversal 9929b50d902SRodney W. Grimesbegan, some legal expressions could have unexpected results. 993bfd12208SRuslan ErmilovAn example is the expression 994bfd12208SRuslan Ermilov.Ic -print Cm -o Ic -depth . 995bfd12208SRuslan ErmilovAs 996bfd12208SRuslan Ermilov.Ic -print 997bfd12208SRuslan Ermilovalways evaluates to true, the standard order of evaluation 998bfd12208SRuslan Ermilovimplies that 999bfd12208SRuslan Ermilov.Ic -depth 1000bfd12208SRuslan Ermilovwould never be evaluated. 10019b50d902SRodney W. GrimesThis is not the case. 10029b50d902SRodney W. Grimes.Pp 1003bfd12208SRuslan ErmilovThe operator 1004bfd12208SRuslan Ermilov.Cm -or 1005bfd12208SRuslan Ermilovwas implemented as 1006bfd12208SRuslan Ermilov.Cm -o , 1007bfd12208SRuslan Ermilovand the operator 1008bfd12208SRuslan Ermilov.Cm -and 1009bfd12208SRuslan Ermilovwas implemented as 1010bfd12208SRuslan Ermilov.Cm -a . 10119b50d902SRodney W. Grimes.Pp 10129b50d902SRodney W. GrimesHistoric implementations of the 1013bfd12208SRuslan Ermilov.Ic -exec 10149b50d902SRodney W. Grimesand 1015bfd12208SRuslan Ermilov.Ic -ok 1016bfd12208SRuslan Ermilovprimaries did not replace the string 1017bfd12208SRuslan Ermilov.Dq Li {} 1018bfd12208SRuslan Ermilovin the utility name or the 10199b50d902SRodney W. Grimesutility arguments if it had preceding or following non-whitespace characters. 10209b50d902SRodney W. GrimesThis version replaces it no matter where in the utility name or arguments 10219b50d902SRodney W. Grimesit appears. 10227c1d4b3aSAkinori MUSHA.Pp 10237c1d4b3aSAkinori MUSHAThe 10247c1d4b3aSAkinori MUSHA.Fl E 102547d91ba3SDag-Erling Smørgravoption was inspired by the equivalent 10267c1d4b3aSAkinori MUSHA.Xr grep 1 10277c1d4b3aSAkinori MUSHAand 102847d91ba3SDag-Erling Smørgrav.Xr sed 1 102947d91ba3SDag-Erling Smørgravoptions. 1030ad487600SColin Percival.Sh HISTORY 1031ad487600SColin PercivalA 1032ad487600SColin Percival.Nm 1033ad487600SColin Percivalcommand appeared in 1034ad487600SColin Percival.At v1 . 10359b50d902SRodney W. Grimes.Sh BUGS 10369b50d902SRodney W. GrimesThe special characters used by 10378fe908efSRuslan Ermilov.Nm 10389b50d902SRodney W. Grimesare also special characters to many shell programs. 1039bfd12208SRuslan ErmilovIn particular, the characters 1040bfd12208SRuslan Ermilov.Dq Li * , 1041bfd12208SRuslan Ermilov.Dq Li \&[ , 1042bfd12208SRuslan Ermilov.Dq Li \&] , 1043bfd12208SRuslan Ermilov.Dq Li \&? , 1044bfd12208SRuslan Ermilov.Dq Li \&( , 1045bfd12208SRuslan Ermilov.Dq Li \&) , 1046bfd12208SRuslan Ermilov.Dq Li \&! , 1047bfd12208SRuslan Ermilov.Dq Li \e 1048bfd12208SRuslan Ermilovand 1049bfd12208SRuslan Ermilov.Dq Li \&; 1050bfd12208SRuslan Ermilovmay have to be escaped from the shell. 10519b50d902SRodney W. Grimes.Pp 10529b50d902SRodney W. GrimesAs there is no delimiter separating options and file names or file 10539b50d902SRodney W. Grimesnames and the 10549b50d902SRodney W. Grimes.Ar expression , 1055bfd12208SRuslan Ermilovit is difficult to specify files named 1056bfd12208SRuslan Ermilov.Pa -xdev 1057bfd12208SRuslan Ermilovor 1058bfd12208SRuslan Ermilov.Pa \&! . 10599b50d902SRodney W. GrimesThese problems are handled by the 10609b50d902SRodney W. Grimes.Fl f 10619b50d902SRodney W. Grimesoption and the 10629b50d902SRodney W. Grimes.Xr getopt 3 1063bfd12208SRuslan Ermilov.Dq Fl Fl 1064bfd12208SRuslan Ermilovconstruct. 1065abacbbbfSPeter Wemm.Pp 1066abacbbbfSPeter WemmThe 1067abacbbbfSPeter Wemm.Ic -delete 106856f7a840SBill Fumerolaprimary does not interact well with other options that cause the file system 1069abacbbbfSPeter Wemmtree traversal options to be changed. 1070ad487600SColin Percival.Pp 10714f45d811STim J. RobbinsThe 1072dfef91e9SColin Percival.Ic -mindepth 1073dfef91e9SColin Percivaland 1074dfef91e9SColin Percival.Ic -maxdepth 10752cb640f6SColin Percivalprimaries are actually global options (as documented above). 10762cb640f6SColin PercivalThey should 1077dfef91e9SColin Percivalprobably be replaced by options which look like options. 1078