man(1) Manual page archive


     FIND(1)                                                   FIND(1)

     NAME
          find - find files

     SYNOPSIS
          find pathname ... expression

     DESCRIPTION
          Find recursively descends the directory hierarchy for each
          pathname, seeking files that match a boolean expression,
          which consists of one or more arguments.  It does not follow
          symbolic links.  In the following descriptions of primary
          expressions, n is a decimal integer; +n may be written to
          specify more than n and -n to specify less.

          -name filename
                    True if the filename argument matches the current
                    file name.  Normal shell filename metacharacters
                    may be used if quoted.

          -perm onum
                    True if the file permission flags exactly match
                    the octal number onum (see chmod(1)). If onum is
                    prefixed by a minus sign, more mode bits (017777,
                    see stat(2)) become significant and the modes are
                    compared: (mode&onum)==onum.

          -type c   True if the type of the file is c, where c is b,
                    c, d, f, or L for block special file, character
                    special file, directory, plain file or symbolic
                    link.

          -links n  True if the file has n links.

          -user uname
                    True if the file belongs to the user uname (login
                    name or numeric userid).

          -group gname
                    True if the file belongs to group gname (group
                    name or numeric groupid).

          -size n   True if the file is n blocks long (512 bytes per
                    block).

          -inum n   True if the file has inode number n.

          -atime n  True if the file has been accessed in n days.

          -mtime n  True if the file has been modified in n days.

     FIND(1)                                                   FIND(1)

          -ctime n  True if the inode has been changed in n days.

          -exec command
                    True if the executed command returns a zero value
                    as exit status.  The end of the command must be
                    punctuated by an escaped semicolon.  A command
                    argument `{}' is replaced by the current pathname.

          -ok command
                    Like -exec except that the generated command is
                    written on the standard output, then the standard
                    input is read and the command executed only upon
                    response y.

          -print    Always true; causes the current pathname to be
                    printed.

          -newer file
                    True if the file has been modified more recently
                    than the argument file.

          -status n True if lstat (see stat(2)) applied to the file
                    yields error number n; see intro(2). Testing `-
                    status' turns off diagnostics that errors normally
                    produce.  On ordinary systems a nonzero error num-
                    ber occurs when a file disappears underfoot or a
                    file system is in trouble.

          The following operators, listed in order of decreasing
          precedence, may be used to combine primary expressions.

          ( expression )
               Group with parentheses.

          ! expression
               Negation.  True if and only if expression is not true.

          expression expression
               Conjunction.  True if both expressions are true.

          expression -o expression
               Disjunction.  True if either expression is true.

     EXAMPLES
          find / \( -name a.out -o -name '*.o' \) -atime +7 -exec rm
               '{}' \;
               Remove all files named `a.out' or `*.o' that have not
               been accessed for a week.

     FILES
     SEE ALSO
          sh(1), test(1), filsys(5)