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

1.63    ! otto        1: .\"    $OpenBSD: find.1,v 1.62 2006/10/11 11:46:04 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.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
                    369: .Pf ( Dv S_ISUID
                    370: |
                    371: .Dv S_ISGID
                    372: |
                    373: .Dv S_ISTXT
                    374: |
                    375: .Dv S_IRWXU
                    376: |
                    377: .Dv S_IRWXG
                    378: |
                    379: .Dv S_IRWXO )
                    380: of the file's mode bits participate
                    381: in the comparison.
1.22      aaron     382: If the mode is preceded by a dash
1.54      jmc       383: .Pq Sq - ,
1.22      aaron     384: this primary evaluates to true
1.1       deraadt   385: if at least all of the bits in the mode are set in the file's mode bits.
1.22      aaron     386: If the mode is not preceded by a dash, this primary evaluates to
1.16      aaron     387: true if the bits in the mode exactly match the file's mode bits.
1.22      aaron     388: Note, the first character of a symbolic mode may not be a dash.
1.1       deraadt   389: .It Ic -print
                    390: This primary always evaluates to true.
                    391: It prints the pathname of the current file to standard output, followed
1.22      aaron     392: by a newline
                    393: .Pq Ql \en
                    394: character.
1.1       deraadt   395: If neither
                    396: .Ic -exec ,
                    397: .Ic -ls ,
                    398: .Ic -ok ,
                    399: nor
                    400: .Ic -print0
                    401: is specified, the given expression shall be effectively replaced by
1.22      aaron     402: .Cm \&( Ns Ar given\& expression Ns Cm \&)
1.1       deraadt   403: .Ic -print .
                    404: .It Ic -print0
                    405: This primary always evaluates to true.
                    406: It prints the pathname of the current file to standard output, followed
                    407: by a null character.
                    408: .It Ic -prune
                    409: This primary always evaluates to true.
                    410: It causes
1.22      aaron     411: .Nm
1.1       deraadt   412: to not descend into the current file.
                    413: Note, the
                    414: .Ic -prune
                    415: primary has no effect if the
                    416: .Fl d
                    417: option was specified.
1.22      aaron     418: .It Ic -size Ar n Ns Op Cm c
                    419: True if the file's size, rounded up, in 512-byte blocks is
1.25      aaron     420: .Ar n .
1.1       deraadt   421: If
                    422: .Ar n
1.22      aaron     423: is followed by a
                    424: .Sq c ,
                    425: then the primary is true if the
1.1       deraadt   426: file's size is
                    427: .Ar n
                    428: bytes.
1.22      aaron     429: .It Ic -type Ar t
1.1       deraadt   430: True if the file is of the specified type.
                    431: Possible file types are as follows:
                    432: .Pp
                    433: .Bl -tag -width flag -offset indent -compact
                    434: .It Cm b
                    435: block special
                    436: .It Cm c
                    437: character special
                    438: .It Cm d
                    439: directory
                    440: .It Cm f
                    441: regular file
                    442: .It Cm l
                    443: symbolic link
                    444: .It Cm p
                    445: FIFO
                    446: .It Cm s
                    447: socket
                    448: .El
                    449: .Pp
1.22      aaron     450: .It Ic -user Ar uname
1.1       deraadt   451: True if the file belongs to the user
1.25      aaron     452: .Ar uname .
1.1       deraadt   453: If
                    454: .Ar uname
                    455: is numeric and there is no such user name, then
                    456: .Ar uname
1.16      aaron     457: is treated as a user ID.
1.56      jmc       458: .It Ic -xdev
1.61      jmc       459: This primary always evaluates to true.
1.56      jmc       460: The same as specifying the
                    461: .Fl x
                    462: option.
1.1       deraadt   463: .El
                    464: .Pp
                    465: All primaries which take a numeric argument allow the number to be
1.22      aaron     466: preceded by a plus sign
                    467: .Pq Ql +
                    468: or a minus sign
1.54      jmc       469: .Pq Ql - .
1.22      aaron     470: A preceding plus sign means
                    471: .Dq more than n ,
                    472: a preceding minus sign means
                    473: .Dq less than n ,
                    474: and neither means
                    475: .Dq exactly n .
1.1       deraadt   476: .Sh OPERATORS
                    477: The primaries may be combined using the following operators.
                    478: The operators are listed in order of decreasing precedence.
1.47      jmc       479: .Pp
                    480: .Bl -tag -width "(expression)" -compact
1.51      jmc       481: .It Cm \&( Ar expression Cm \&)
1.1       deraadt   482: This evaluates to true if the parenthesized expression evaluates to
                    483: true.
                    484: .Pp
1.51      jmc       485: .It Cm \&! Ar expression
1.1       deraadt   486: This is the unary
                    487: .Tn NOT
                    488: operator.
                    489: It evaluates to true if the expression is false.
                    490: .Pp
1.22      aaron     491: .It Ar expression Cm -and Ar expression
                    492: .It Ar expression expression
1.1       deraadt   493: The
                    494: .Cm -and
                    495: operator is the logical
                    496: .Tn AND
                    497: operator.
                    498: As it is implied by the juxtaposition of two expressions it does not
                    499: have to be specified.
                    500: The expression evaluates to true if both expressions are true.
                    501: The second expression is not evaluated if the first expression is false.
                    502: .Pp
1.22      aaron     503: .It Ar expression Cm -or Ar expression
1.1       deraadt   504: The
                    505: .Cm -or
                    506: operator is the logical
                    507: .Tn OR
                    508: operator.
                    509: The expression evaluates to true if either the first or the second expression
                    510: is true.
                    511: The second expression is not evaluated if the first expression is true.
                    512: .El
                    513: .Pp
1.53      otto      514: Operators, primaries, and arguments to primaries must be separate
                    515: arguments to
                    516: .Nm find ,
                    517: i.e. they should be separated by whitespace.
1.1       deraadt   518: .Sh EXAMPLES
1.62      jmc       519: Print out a list of all the files whose names end in
1.43      jaredy    520: .Dq \&.c :
                    521: .Pp
1.62      jmc       522: .Dl "$ find / -name '*.c'"
1.43      jaredy    523: .Pp
1.22      aaron     524: Print out a list of all the files which are not both newer than
                    525: .Dq ttt
                    526: and owned by
1.43      jaredy    527: .Dq wnj :
                    528: .Pp
1.62      jmc       529: .Dl "$ find / \e! \e( -newer ttt -user wnj \e)"
1.43      jaredy    530: .Pp
                    531: Print out a list of all core files on local file systems:
                    532: .Pp
1.62      jmc       533: .Dl "$ find / \e! -fstype local -prune -or -name '*.core'"
1.46      jmc       534: .Pp
                    535: Find all files in
                    536: .Pa /usr/src
                    537: ending in a dot and single digit, but skip directory
                    538: .Pa /usr/src/gnu :
                    539: .Pp
1.62      jmc       540: .Dl "$ find /usr/src -path /usr/src/gnu -prune -or -name \e*.[0-9]"
                    541: .Pp
                    542: Find and remove all *.jpg files in the current working directory:
                    543: .Pp
                    544: .Dl "$ find . -name \e*.jpg -exec rm {} \e;"
1.63    ! otto      545: or
        !           546: .Dl "$ find . -name \e*.jpg | xargs rm"
1.1       deraadt   547: .Sh SEE ALSO
1.29      millert   548: .Xr chflags 1 ,
1.1       deraadt   549: .Xr chmod 1 ,
                    550: .Xr locate 1 ,
1.23      aaron     551: .Xr whereis 1 ,
                    552: .Xr which 1 ,
1.41      millert   553: .Xr xargs 1 ,
1.1       deraadt   554: .Xr stat 2 ,
                    555: .Xr fts 3 ,
1.16      aaron     556: .Xr getgrent 3 ,
1.1       deraadt   557: .Xr getpwent 3 ,
                    558: .Xr strmode 3 ,
                    559: .Xr symlink 7
                    560: .Sh STANDARDS
                    561: The
1.22      aaron     562: .Nm
1.1       deraadt   563: utility syntax is a superset of the syntax specified by the
1.55      jmc       564: .St -p1003.1-2004
1.1       deraadt   565: standard.
                    566: .Pp
1.55      jmc       567: The options
                    568: .Op Fl dfhXx
                    569: and primaries
1.18      deraadt   570: .Ic -amin ,
1.55      jmc       571: .Ic -anewer ,
1.18      deraadt   572: .Ic -cmin ,
1.55      jmc       573: .Ic -cnewer ,
1.9       tholo     574: .Ic -empty ,
1.55      jmc       575: .Ic -execdir ,
                    576: .Ic -flags ,
1.1       deraadt   577: .Ic -follow ,
                    578: .Ic -fstype ,
1.27      deraadt   579: .Ic -iname ,
1.2       deraadt   580: .Ic -inum ,
1.9       tholo     581: .Ic -ls ,
                    582: .Ic -maxdepth ,
1.13      deraadt   583: .Ic -mindepth ,
1.55      jmc       584: .Ic -mmin ,
                    585: .Ic -path ,
1.1       deraadt   586: and
                    587: .Ic -print0
1.13      deraadt   588: are extensions to
1.55      jmc       589: .St -p1003.1-2004 .
1.27      deraadt   590: The
                    591: .Ic -iname
1.57      otto      592: primary was inspired by GNU find.
1.1       deraadt   593: .Pp
                    594: Historically, the
                    595: .Fl d ,
1.26      aaron     596: .Fl H ,
1.1       deraadt   597: and
                    598: .Fl x
1.14      deraadt   599: options were implemented using the primaries
                    600: .Ic -depth ,
                    601: .Ic -follow ,
                    602: and
                    603: .Ic -xdev .
1.1       deraadt   604: These primaries always evaluated to true.
                    605: As they were really global variables that took effect before the traversal
                    606: began, some legal expressions could have unexpected results.
1.22      aaron     607: An example is the expression
1.54      jmc       608: .Dq -print -o -depth .
1.22      aaron     609: As
1.54      jmc       610: .Cm -print
1.22      aaron     611: always evaluates to true, the standard order of evaluation
                    612: implies that
1.54      jmc       613: .Cm -depth
1.22      aaron     614: would never be evaluated.
1.1       deraadt   615: This is not the case.
                    616: .Pp
1.22      aaron     617: The operator
                    618: .Cm -or
                    619: was implemented as
1.54      jmc       620: .Cm -o ,
1.22      aaron     621: and the operator
                    622: .Cm -and
                    623: was implemented as
1.54      jmc       624: .Cm -a .
1.1       deraadt   625: .Pp
                    626: Historic implementations of the
                    627: .Ic -exec
                    628: and
                    629: .Ic -ok
1.22      aaron     630: primaries did not replace the string
                    631: .Qq {}
                    632: in the utility name or the
1.1       deraadt   633: utility arguments if it had preceding or following non-whitespace characters.
                    634: This version replaces it no matter where in the utility name or arguments
                    635: it appears.
1.30      aaron     636: .Sh HISTORY
                    637: A
                    638: .Nm
                    639: command appeared in
                    640: .At v1 .
1.50      jmc       641: .Sh CAVEATS
1.1       deraadt   642: The special characters used by
1.22      aaron     643: .Nm
1.1       deraadt   644: are also special characters to many shell programs.
1.22      aaron     645: In particular, the characters
                    646: .Ql * ,
                    647: .Ql [ ,
                    648: .Ql \&] ,
1.40      jmc       649: .Ql \&? ,
1.22      aaron     650: .Ql ( ,
                    651: .Ql \&) ,
1.40      jmc       652: .Ql \&! ,
1.22      aaron     653: .Ql \e ,
                    654: and
                    655: .Ql \&;
                    656: may have to be escaped from the shell.
1.1       deraadt   657: .Pp
                    658: As there is no delimiter separating options and file names or file
                    659: names and the
                    660: .Ar expression ,
1.22      aaron     661: it is difficult to specify files named
                    662: .Dq -xdev
                    663: or
1.40      jmc       664: .Dq \&! .
1.1       deraadt   665: These problems are handled by the
                    666: .Fl f
                    667: option and the
                    668: .Xr getopt 3
1.54      jmc       669: .Dq --
1.22      aaron     670: construct.