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