[BACK]Return to find.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / find

Annotation of src/usr.bin/find/find.1, Revision 1.75

1.75    ! schwarze    1: .\"    $OpenBSD: find.1,v 1.74 2009/04/09 14:30:39 jmc Exp $
1.1       deraadt     2: .\" Copyright (c) 1990, 1993
                      3: .\"    The Regents of the University of California.  All rights reserved.
                      4: .\"
                      5: .\" This code is derived from software contributed to Berkeley by
                      6: .\" the Institute of Electrical and Electronics Engineers, Inc.
                      7: .\"
                      8: .\" Redistribution and use in source and binary forms, with or without
                      9: .\" modification, are permitted provided that the following conditions
                     10: .\" are met:
                     11: .\" 1. Redistributions of source code must retain the above copyright
                     12: .\"    notice, this list of conditions and the following disclaimer.
                     13: .\" 2. Redistributions in binary form must reproduce the above copyright
                     14: .\"    notice, this list of conditions and the following disclaimer in the
                     15: .\"    documentation and/or other materials provided with the distribution.
1.38      millert    16: .\" 3. Neither the name of the University nor the names of its contributors
1.1       deraadt    17: .\"    may be used to endorse or promote products derived from this software
                     18: .\"    without specific prior written permission.
                     19: .\"
                     20: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     21: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     22: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     23: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     24: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     25: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     26: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     27: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     28: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     29: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     30: .\" SUCH DAMAGE.
                     31: .\"
                     32: .\"    from: @(#)find.1        8.1 (Berkeley) 6/6/93
                     33: .\"
1.75    ! schwarze   34: .Dd $Mdocdate: April 9 2009 $
1.1       deraadt    35: .Dt FIND 1
                     36: .Os
                     37: .Sh NAME
                     38: .Nm find
                     39: .Nd walk a file hierarchy
                     40: .Sh SYNOPSIS
                     41: .Nm find
1.48      millert    42: .Op Fl dHhLXx
1.43      jaredy     43: .Op Fl f Ar path
                     44: .Ar path ...\&
1.34      deraadt    45: .Op Ar expression
1.1       deraadt    46: .Sh DESCRIPTION
1.22      aaron      47: .Nm
1.1       deraadt    48: recursively descends the directory tree for each
1.43      jaredy     49: .Ar path
1.1       deraadt    50: listed, evaluating an
                     51: .Ar expression
1.22      aaron      52: (composed of the
                     53: .Dq primaries
                     54: and
1.52      otto       55: .Dq operators
1.22      aaron      56: listed below) in terms
1.12      millert    57: of each file in the tree.
1.34      deraadt    58: In the absence of an expression,
                     59: .Ic -print
                     60: is assumed.
1.66      jmc        61: If an expression is given,
                     62: but none of the primaries
                     63: .Ic -exec ,
                     64: .Ic -ls ,
                     65: .Ic -ok ,
                     66: .Ic -print ,
                     67: or
                     68: .Ic -print0
1.67      jmc        69: are specified, the given expression is effectively replaced by
1.66      jmc        70: .Cm \&( Ar given expression Cm \&)
                     71: .Ic -print .
1.1       deraadt    72: .Pp
                     73: The options are as follows:
                     74: .Bl -tag -width Ds
                     75: .It Fl d
1.16      aaron      76: Causes
1.22      aaron      77: .Nm
1.45      jmc        78: to visit directories in post-order
                     79: i.e. all entries in a directory will be acted on before the directory itself.
1.1       deraadt    80: By default,
1.22      aaron      81: .Nm
1.45      jmc        82: visits directories in pre-order i.e. before their contents.
1.43      jaredy     83: .It Fl f Ar path
1.16      aaron      84: Specifies a file hierarchy for
1.22      aaron      85: .Nm
1.1       deraadt    86: to traverse.
1.52      otto       87: File hierarchies may be specified without the
                     88: .Fl f
                     89: option if they are given immediately after any other options.
1.35      millert    90: .It Fl H
                     91: Causes the file information and file type (see
                     92: .Xr stat 2 )
                     93: returned for each symbolic link encountered on the command line to be
                     94: those of the file referenced by the link, not the link itself.
                     95: If the referenced file does not exist, the file information and type will
                     96: be for the link itself.
                     97: File information of all symbolic links not on
                     98: the command line is that of the link itself.
1.75    ! schwarze   99: This option overrides
        !           100: .Fl L
        !           101: given earlier on the command line.
1.1       deraadt   102: .It Fl h
1.35      millert   103: An alias for the
                    104: .Fl L
                    105: option.
1.37      david     106: This option exists for backwards compatibility.
1.35      millert   107: .It Fl L
1.16      aaron     108: Causes the file information and file type (see
1.22      aaron     109: .Xr stat 2 )
1.1       deraadt   110: returned for each symbolic link to be those of the file referenced by the
                    111: link, not the link itself.
                    112: If the referenced file does not exist, the file information and type will
                    113: be for the link itself.
1.75    ! schwarze  114: This option overrides
        !           115: .Fl H
        !           116: given earlier on the command line.
1.1       deraadt   117: .It Fl X
1.16      aaron     118: Permit
1.1       deraadt   119: .Nm
                    120: to be safely used in conjunction with
                    121: .Xr xargs 1 .
                    122: If a file name contains any of the delimiting characters used by
                    123: .Xr xargs ,
                    124: a diagnostic message is displayed on standard error, and the file
                    125: is skipped.
1.22      aaron     126: The delimiting characters include single
                    127: .Pq Ql '
                    128: and double
                    129: .Pq Ql \&"
                    130: quotes, backslash
                    131: .Pq Ql \e ,
                    132: space, tab, and newline
                    133: .Pq Sq \en
                    134: characters.
1.41      millert   135: Alternatively, the
1.4       deraadt   136: .Fl print0
1.41      millert   137: primary may be used in conjunction with the
1.4       deraadt   138: .Fl 0
1.41      millert   139: option to
                    140: .Xr xargs 1 ,
                    141: allowing all file names to be processed safely.
1.1       deraadt   142: .It Fl x
1.16      aaron     143: Prevents
1.22      aaron     144: .Nm
1.1       deraadt   145: from descending into directories that have a device number different
                    146: than that of the file from which the descent began.
                    147: .El
                    148: .Sh PRIMARIES
                    149: .Bl -tag -width Ds
1.22      aaron     150: .It Ic -amin Ar n
1.15      deraadt   151: True if the difference between the file last access time and the time
1.22      aaron     152: .Nm
1.20      aaron     153: was started, rounded up to the next full minute, is
1.15      deraadt   154: .Ar n
1.20      aaron     155: minutes.
1.24      millert   156: .It Ic -anewer Ar file
                    157: True if the current file has a more recent last access time than
1.25      aaron     158: .Ar file .
1.22      aaron     159: .It Ic -atime Ar n
1.1       deraadt   160: True if the difference between the file last access time and the time
1.22      aaron     161: .Nm
                    162: was started, rounded up to the next full 24-hour period, is
1.1       deraadt   163: .Ar n
1.22      aaron     164: 24-hour periods.
                    165: .It Ic -cmin Ar n
1.15      deraadt   166: True if the difference between the time of last change of file status
                    167: information and the time
1.22      aaron     168: .Nm
1.20      aaron     169: was started, rounded up to the next full minute, is
1.15      deraadt   170: .Ar n
1.20      aaron     171: minutes.
1.24      millert   172: .It Ic -cnewer Ar file
                    173: True if the current file has a more recent last change time than
1.25      aaron     174: .Ar file .
1.22      aaron     175: .It Ic -ctime Ar n
1.1       deraadt   176: True if the difference between the time of last change of file status
                    177: information and the time
1.22      aaron     178: .Nm
                    179: was started, rounded up to the next full 24-hour period, is
1.1       deraadt   180: .Ar n
1.22      aaron     181: 24-hour periods.
1.56      jmc       182: .It Ic -depth
1.61      jmc       183: This primary always evaluates to true.
1.56      jmc       184: The same as specifying the
                    185: .Fl d
                    186: option.
1.8       tholo     187: .It Ic -empty
                    188: True if the current file or directory is empty.
1.59      jmc       189: .It Xo
                    190: .Ic -exec Ar utility
                    191: .Op argument ...
                    192: .No ;
                    193: .Xc
1.1       deraadt   194: True if the program named
                    195: .Ar utility
                    196: returns a zero value as its exit status.
                    197: Optional arguments may be passed to the utility.
1.22      aaron     198: The expression must be terminated by a semicolon
                    199: .Pq Ql \&; .
                    200: If the string
                    201: .Qq {}
                    202: appears anywhere in the utility name or the
1.1       deraadt   203: arguments it is replaced by the pathname of the current file.
1.16      aaron     204: .Ar utility
1.1       deraadt   205: will be executed from the directory from which
1.22      aaron     206: .Nm
1.1       deraadt   207: was executed.
1.63      otto      208: .Pp
                    209: Since
                    210: .Ar utility
                    211: is executed every time a match is made,
                    212: it is often more efficient to pipe the output of
                    213: .Nm
                    214: to
                    215: .Xr xargs 1 .
1.59      jmc       216: .It Xo
                    217: .Ic -execdir Ar utility
                    218: .Op argument ...
                    219: .No ;
                    220: .Xc
1.22      aaron     221: Identical to the
1.10      millert   222: .Ic -exec
                    223: primary with the exception that
1.16      aaron     224: .Ar utility
1.10      millert   225: will be executed from the directory that holds
1.25      aaron     226: the current file.
                    227: The filename substituted for the string
1.22      aaron     228: .Qq {}
                    229: is not qualified.
1.28      millert   230: .It Xo
                    231: .Ic -flags
1.65      jmc       232: .Oo - Oc Ns Ar flags
1.28      millert   233: .Xc
                    234: The
                    235: .Ar flags
                    236: are comma-separated symbolic file flags (see
                    237: .Xr chflags 1
                    238: for a list of valid flag names).
                    239: If the flags are preceded by a dash
1.54      jmc       240: .Pq Sq - ,
1.49      otto      241: this primary evaluates to true if at least all specified
                    242: .Ar flags
                    243: are set in the file's flags.
1.28      millert   244: If the flags are not preceded by a dash, this primary evaluates to true if the
                    245: flags specified exactly match those of the file.
1.2       deraadt   246: .It Ic -follow
1.61      jmc       247: This primary always evaluates to true.
1.56      jmc       248: The same as specifying the
                    249: .Fl H
                    250: option.
1.22      aaron     251: .It Ic -fstype Ar type
1.1       deraadt   252: True if the file is contained in a file system of type
                    253: .Ar type .
1.22      aaron     254: Two special file system types are recognized:
                    255: .Dq local
                    256: and
                    257: .Dq rdonly .
1.1       deraadt   258: These do not describe actual file system types;
                    259: the former matches any file system physically mounted on the system where
1.22      aaron     260: .Nm
                    261: is being executed whereas the latter matches any file system which is
1.1       deraadt   262: mounted read-only.
1.22      aaron     263: .It Ic -group Ar gname
1.1       deraadt   264: True if the file belongs to the group
1.25      aaron     265: .Ar gname .
1.1       deraadt   266: If
                    267: .Ar gname
                    268: is numeric and there is no such group name, then
                    269: .Ar gname
1.16      aaron     270: is treated as a group ID.
1.27      deraadt   271: .It Ic -iname Ar pattern
                    272: True if the last component of the pathname being examined
                    273: matches
                    274: .Ar pattern .
                    275: Case insensitive.
1.22      aaron     276: .It Ic -inum Ar n
1.1       deraadt   277: True if the file has inode number
1.25      aaron     278: .Ar n .
1.22      aaron     279: .It Ic -links Ar n
1.1       deraadt   280: True if the file has
                    281: .Ar n
                    282: links.
                    283: .It Ic -ls
                    284: This primary always evaluates to true.
                    285: The following information for the current file is written to standard output:
1.22      aaron     286: its inode number, size in 512-byte blocks, file permissions, number of hard
1.1       deraadt   287: links, owner, group, size in bytes, last modification time, and pathname.
                    288: If the file is a block or character special file, the major and minor numbers
                    289: will be displayed instead of the size in bytes.
1.22      aaron     290: If the file is a symbolic link, the pathname of the linked-to file will be
                    291: displayed preceded by
1.54      jmc       292: .Dq -\*(Gt .
1.22      aaron     293: The format is identical to that produced by
1.71      jmc       294: .Dq ls -dils .
1.6       tholo     295: .It Ic -maxdepth Ar n
1.7       tholo     296: True if the current search depth is less than or equal to what is specified in
                    297: .Ar n .
                    298: .It Ic -mindepth Ar n
                    299: True if the current search depth is at least what is specified in
1.6       tholo     300: .Ar n .
1.22      aaron     301: .It Ic -mmin Ar n
1.15      deraadt   302: True if the difference between the file last modification time and the time
1.22      aaron     303: .Nm
1.20      aaron     304: was started, rounded up to the next full minute, is
1.15      deraadt   305: .Ar n
1.20      aaron     306: minutes.
1.22      aaron     307: .It Ic -mtime Ar n
1.1       deraadt   308: True if the difference between the file last modification time and the time
1.22      aaron     309: .Nm
                    310: was started, rounded up to the next full 24-hour period, is
1.1       deraadt   311: .Ar n
1.22      aaron     312: 24-hour periods.
                    313: .It Ic -name Ar pattern
1.1       deraadt   314: True if the last component of the pathname being examined matches
1.25      aaron     315: .Ar pattern .
1.22      aaron     316: Special shell pattern matching characters
                    317: .Pf ( Ql [ ,
                    318: .Ql \&] ,
                    319: .Ql * ,
                    320: and
1.40      jmc       321: .Ql \&? )
1.1       deraadt   322: may be used as part of
1.25      aaron     323: .Ar pattern .
1.1       deraadt   324: These characters may be matched explicitly by escaping them with a
1.22      aaron     325: backslash
                    326: .Pq Ql \e .
                    327: .It Ic -newer Ar file
1.1       deraadt   328: True if the current file has a more recent last modification time than
1.25      aaron     329: .Ar file .
1.44      jmc       330: .It Ic -nogroup
                    331: True if the file belongs to an unknown group.
1.1       deraadt   332: .It Ic -nouser
                    333: True if the file belongs to an unknown user.
1.60      jmc       334: .It Xo
                    335: .Ic -ok Ar utility
                    336: .Op argument ...
                    337: .No ;
                    338: .Xc
1.22      aaron     339: Identical to the
                    340: .Ic -exec
                    341: primary with the exception that
                    342: .Nm
                    343: requests user affirmation for the execution of
                    344: .Ar utility
                    345: by printing
                    346: a message to the terminal and reading a response.
                    347: If the response is other than
                    348: .Sq y
                    349: the command is not executed and the
                    350: value of the
1.54      jmc       351: .Ic ok
1.22      aaron     352: expression is false.
                    353: .It Ic -path Ar pattern
1.1       deraadt   354: True if the pathname being examined matches
1.25      aaron     355: .Ar pattern .
1.22      aaron     356: Special shell pattern matching characters
                    357: .Pf ( Ql [ ,
                    358: .Ql \&] ,
                    359: .Ql * ,
                    360: and
1.40      jmc       361: .Ql \&? )
1.1       deraadt   362: may be used as part of
1.25      aaron     363: .Ar pattern .
1.1       deraadt   364: These characters may be matched explicitly by escaping them with a
1.22      aaron     365: backslash
                    366: .Pq Ql \e .
                    367: Slashes
                    368: .Pq Ql /
                    369: are treated as normal characters and do not have to be
1.1       deraadt   370: matched explicitly.
1.21      aaron     371: .It Xo
                    372: .Ic -perm
1.65      jmc       373: .Oo - Oc Ns Ar mode
1.21      aaron     374: .Xc
1.1       deraadt   375: The
                    376: .Ar mode
                    377: may be either symbolic (see
1.25      aaron     378: .Xr chmod 1 )
1.1       deraadt   379: or an octal number.
                    380: If the mode is symbolic, a starting value of zero is assumed and the
1.16      aaron     381: mode sets or clears permissions without regard to the process's file mode
1.1       deraadt   382: creation mask.
                    383: If the mode is octal, only bits 07777
1.64      jmc       384: .Po
1.70      kili      385: .Dv S_ISUID \*(Ba S_ISGID \*(Ba S_ISTXT \*(Ba
1.64      jmc       386: .Dv S_IRWXU \*(Ba S_IRWXG \*(Ba S_IRWXO
                    387: .Pc
1.1       deraadt   388: of the file's mode bits participate
                    389: in the comparison.
1.22      aaron     390: If the mode is preceded by a dash
1.54      jmc       391: .Pq Sq - ,
1.22      aaron     392: this primary evaluates to true
1.1       deraadt   393: if at least all of the bits in the mode are set in the file's mode bits.
1.22      aaron     394: If the mode is not preceded by a dash, this primary evaluates to
1.16      aaron     395: true if the bits in the mode exactly match the file's mode bits.
1.22      aaron     396: Note, the first character of a symbolic mode may not be a dash.
1.1       deraadt   397: .It Ic -print
                    398: This primary always evaluates to true.
                    399: It prints the pathname of the current file to standard output, followed
1.22      aaron     400: by a newline
                    401: .Pq Ql \en
                    402: character.
1.1       deraadt   403: .It Ic -print0
                    404: This primary always evaluates to true.
                    405: It prints the pathname of the current file to standard output, followed
                    406: by a null character.
                    407: .It Ic -prune
                    408: This primary always evaluates to true.
                    409: It causes
1.22      aaron     410: .Nm
1.1       deraadt   411: to not descend into the current file.
                    412: Note, the
                    413: .Ic -prune
                    414: primary has no effect if the
                    415: .Fl d
                    416: option was specified.
1.22      aaron     417: .It Ic -size Ar n Ns Op Cm c
                    418: True if the file's size, rounded up, in 512-byte blocks is
1.25      aaron     419: .Ar n .
1.1       deraadt   420: If
                    421: .Ar n
1.22      aaron     422: is followed by a
                    423: .Sq c ,
                    424: then the primary is true if the
1.1       deraadt   425: file's size is
                    426: .Ar n
                    427: bytes.
1.22      aaron     428: .It Ic -type Ar t
1.1       deraadt   429: True if the file is of the specified type.
                    430: Possible file types are as follows:
                    431: .Pp
                    432: .Bl -tag -width flag -offset indent -compact
                    433: .It Cm b
                    434: block special
                    435: .It Cm c
                    436: character special
                    437: .It Cm d
                    438: directory
                    439: .It Cm f
                    440: regular file
                    441: .It Cm l
                    442: symbolic link
                    443: .It Cm p
                    444: FIFO
                    445: .It Cm s
                    446: socket
                    447: .El
                    448: .Pp
1.22      aaron     449: .It Ic -user Ar uname
1.1       deraadt   450: True if the file belongs to the user
1.25      aaron     451: .Ar uname .
1.1       deraadt   452: If
                    453: .Ar uname
                    454: is numeric and there is no such user name, then
                    455: .Ar uname
1.16      aaron     456: is treated as a user ID.
1.56      jmc       457: .It Ic -xdev
1.61      jmc       458: This primary always evaluates to true.
1.56      jmc       459: The same as specifying the
                    460: .Fl x
                    461: option.
1.1       deraadt   462: .El
                    463: .Pp
                    464: All primaries which take a numeric argument allow the number to be
1.22      aaron     465: preceded by a plus sign
                    466: .Pq Ql +
                    467: or a minus sign
1.54      jmc       468: .Pq Ql - .
1.22      aaron     469: A preceding plus sign means
                    470: .Dq more than n ,
                    471: a preceding minus sign means
                    472: .Dq less than n ,
                    473: and neither means
                    474: .Dq exactly n .
1.74      jmc       475: Exceptions are the primaries
                    476: .Ic mindepth
                    477: and
                    478: .Ic maxdepth .
1.1       deraadt   479: .Sh OPERATORS
                    480: The primaries may be combined using the following operators.
                    481: The operators are listed in order of decreasing precedence.
1.47      jmc       482: .Pp
                    483: .Bl -tag -width "(expression)" -compact
1.51      jmc       484: .It Cm \&( Ar expression Cm \&)
1.1       deraadt   485: This evaluates to true if the parenthesized expression evaluates to
                    486: true.
                    487: .Pp
1.51      jmc       488: .It Cm \&! Ar expression
1.1       deraadt   489: This is the unary
                    490: .Tn NOT
                    491: operator.
                    492: It evaluates to true if the expression is false.
                    493: .Pp
1.22      aaron     494: .It Ar expression Cm -and Ar expression
                    495: .It Ar expression expression
1.1       deraadt   496: The
                    497: .Cm -and
                    498: operator is the logical
                    499: .Tn AND
                    500: operator.
                    501: As it is implied by the juxtaposition of two expressions it does not
                    502: have to be specified.
                    503: The expression evaluates to true if both expressions are true.
                    504: The second expression is not evaluated if the first expression is false.
                    505: .Pp
1.22      aaron     506: .It Ar expression Cm -or Ar expression
1.1       deraadt   507: The
                    508: .Cm -or
                    509: operator is the logical
                    510: .Tn OR
                    511: operator.
                    512: The expression evaluates to true if either the first or the second expression
                    513: is true.
                    514: The second expression is not evaluated if the first expression is true.
                    515: .El
                    516: .Pp
1.53      otto      517: Operators, primaries, and arguments to primaries must be separate
                    518: arguments to
                    519: .Nm find ,
                    520: i.e. they should be separated by whitespace.
1.1       deraadt   521: .Sh EXAMPLES
1.62      jmc       522: Print out a list of all the files whose names end in
1.43      jaredy    523: .Dq \&.c :
                    524: .Pp
1.62      jmc       525: .Dl "$ find / -name '*.c'"
1.43      jaredy    526: .Pp
1.22      aaron     527: Print out a list of all the files which are not both newer than
                    528: .Dq ttt
                    529: and owned by
1.43      jaredy    530: .Dq wnj :
                    531: .Pp
1.62      jmc       532: .Dl "$ find / \e! \e( -newer ttt -user wnj \e)"
1.43      jaredy    533: .Pp
                    534: Print out a list of all core files on local file systems:
                    535: .Pp
1.62      jmc       536: .Dl "$ find / \e! -fstype local -prune -or -name '*.core'"
1.46      jmc       537: .Pp
                    538: Find all files in
                    539: .Pa /usr/src
                    540: ending in a dot and single digit, but skip directory
                    541: .Pa /usr/src/gnu :
                    542: .Pp
1.62      jmc       543: .Dl "$ find /usr/src -path /usr/src/gnu -prune -or -name \e*.[0-9]"
                    544: .Pp
                    545: Find and remove all *.jpg files in the current working directory:
                    546: .Pp
                    547: .Dl "$ find . -name \e*.jpg -exec rm {} \e;"
1.63      otto      548: or
                    549: .Dl "$ find . -name \e*.jpg | xargs rm"
1.1       deraadt   550: .Sh SEE ALSO
1.29      millert   551: .Xr chflags 1 ,
1.1       deraadt   552: .Xr chmod 1 ,
                    553: .Xr locate 1 ,
1.23      aaron     554: .Xr whereis 1 ,
                    555: .Xr which 1 ,
1.41      millert   556: .Xr xargs 1 ,
1.1       deraadt   557: .Xr stat 2 ,
                    558: .Xr fts 3 ,
1.16      aaron     559: .Xr getgrent 3 ,
1.1       deraadt   560: .Xr getpwent 3 ,
                    561: .Xr strmode 3 ,
                    562: .Xr symlink 7
                    563: .Sh STANDARDS
                    564: The
1.22      aaron     565: .Nm
1.68      jmc       566: utility is compliant with the
1.72      jmc       567: .St -p1003.1-2008
1.68      jmc       568: specification.
1.1       deraadt   569: .Pp
1.55      jmc       570: The options
                    571: .Op Fl dfhXx
                    572: and primaries
1.18      deraadt   573: .Ic -amin ,
1.55      jmc       574: .Ic -anewer ,
1.18      deraadt   575: .Ic -cmin ,
1.55      jmc       576: .Ic -cnewer ,
1.9       tholo     577: .Ic -empty ,
1.55      jmc       578: .Ic -execdir ,
                    579: .Ic -flags ,
1.1       deraadt   580: .Ic -follow ,
                    581: .Ic -fstype ,
1.27      deraadt   582: .Ic -iname ,
1.2       deraadt   583: .Ic -inum ,
1.9       tholo     584: .Ic -ls ,
                    585: .Ic -maxdepth ,
1.13      deraadt   586: .Ic -mindepth ,
1.55      jmc       587: .Ic -mmin ,
1.1       deraadt   588: and
                    589: .Ic -print0
1.68      jmc       590: are extensions to that specification.
1.27      deraadt   591: The
                    592: .Ic -iname
1.57      otto      593: primary was inspired by GNU find.
1.1       deraadt   594: .Pp
                    595: Historically, the
                    596: .Fl d ,
1.26      aaron     597: .Fl H ,
1.1       deraadt   598: and
                    599: .Fl x
1.14      deraadt   600: options were implemented using the primaries
                    601: .Ic -depth ,
                    602: .Ic -follow ,
                    603: and
                    604: .Ic -xdev .
1.1       deraadt   605: These primaries always evaluated to true.
                    606: As they were really global variables that took effect before the traversal
                    607: began, some legal expressions could have unexpected results.
1.22      aaron     608: An example is the expression
1.54      jmc       609: .Dq -print -o -depth .
1.22      aaron     610: As
1.54      jmc       611: .Cm -print
1.22      aaron     612: always evaluates to true, the standard order of evaluation
                    613: implies that
1.54      jmc       614: .Cm -depth
1.22      aaron     615: would never be evaluated.
1.1       deraadt   616: This is not the case.
                    617: .Pp
1.22      aaron     618: The operator
                    619: .Cm -or
                    620: was implemented as
1.54      jmc       621: .Cm -o ,
1.22      aaron     622: and the operator
                    623: .Cm -and
                    624: was implemented as
1.54      jmc       625: .Cm -a .
1.1       deraadt   626: .Pp
                    627: Historic implementations of the
                    628: .Ic -exec
                    629: and
                    630: .Ic -ok
1.22      aaron     631: primaries did not replace the string
                    632: .Qq {}
                    633: in the utility name or the
1.1       deraadt   634: utility arguments if it had preceding or following non-whitespace characters.
                    635: This version replaces it no matter where in the utility name or arguments
                    636: it appears.
1.30      aaron     637: .Sh HISTORY
                    638: A
                    639: .Nm
                    640: command appeared in
                    641: .At v1 .
1.50      jmc       642: .Sh CAVEATS
1.1       deraadt   643: The special characters used by
1.22      aaron     644: .Nm
1.1       deraadt   645: are also special characters to many shell programs.
1.22      aaron     646: In particular, the characters
                    647: .Ql * ,
                    648: .Ql [ ,
                    649: .Ql \&] ,
1.40      jmc       650: .Ql \&? ,
1.22      aaron     651: .Ql ( ,
                    652: .Ql \&) ,
1.40      jmc       653: .Ql \&! ,
1.22      aaron     654: .Ql \e ,
                    655: and
                    656: .Ql \&;
                    657: may have to be escaped from the shell.
1.1       deraadt   658: .Pp
                    659: As there is no delimiter separating options and file names or file
                    660: names and the
                    661: .Ar expression ,
1.22      aaron     662: it is difficult to specify files named
                    663: .Dq -xdev
                    664: or
1.65      jmc       665: .Sq \&! .
1.1       deraadt   666: These problems are handled by the
                    667: .Fl f
                    668: option and the
                    669: .Xr getopt 3
1.65      jmc       670: .Sq --
1.22      aaron     671: construct.