[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.64

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