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

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