Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1)

cpio(1)

test(1)

sh(1)

stat(2)

umask(2)

fs(4)



  find(1)                             CLIX                             find(1)



  NAME

    find - Finds files

  SYNOPSIS

    find pathname-list expression

  DESCRIPTION

    The command find recursively descends the directory hierarchy for each
    pathname in the pathname-list (that is, one or more pathnames) seeking
    files that match a boolean expression written in the primaries given
    below.  In the descriptions, the argument n is used as a decimal integer,
    where +n means more than n, -n means less than n and n means exactly n.
    Valid expressions are as follows:

    -name file
           True if file matches the current filename.  Normal shell argument
           syntax may be used if escaped (watch out for [, ?, and *).

    [-perm] [-]onum
           True if the file permission flags are identical to the octal number
           onum (see chmod).  If onum is prefixed by a minus sign, only the
           bits set in onum are compared with the file permission flags and
           the expression evaluates true if they match.

    -type c
           True if the type of the file is c, where c is b, c, d, l, p, or f
           for block special file, character special file, directory, symbolic
           link, fifo (also known as named pipe), or plain file respectively.

    -links n
           True if the file has n links.

    -user uname
           True if the file belongs to the user uname.  If uname is numeric
           and does not appear as a login name in the /etc/passwd file, it is
           interpreted as a user ID.

    -group gname
           True if the file belongs to the group gname.  If gname is numeric
           and does not appear in the /etc/group file, it is interpreted as a
           group ID.

    -size n[c]
           True if the file is n blocks long (512 bytes per block).  If n is
           followed by a c, the size is in characters.

    -inum inode
           Searches for a file by its inode number.



  2/94 - Intergraph Corporation                                              1






  find(1)                             CLIX                             find(1)



    -atime n
           True if the file has been accessed in n days.  The access time of
           directories in pathname-list is changed by find.

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

    -ctime n
           True if the file's inode has been modified n days ago.

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

    -ok cmd
           Resembles -exec except that the generated command line is displayed
           with a question mark first and is executed only if the user
           responds by typing a ``y.''

    -print Always true; displays the current pathname.

    -cpio device
           Always true; write the current file on device in cpio format
           (5120-byte records).

    -newer file
           True if the current file was modified more recently than the
           argument file.

    -depth Always true; causes descent of the directory hierarchy to be done
           so that all entries in a directory are acted on before the
           directory itself.  This can be useful when find is used with cpio
           to transfer files contained in directories without write
           permission.

    -mount Always true; restricts the search to the file system containing the
           directory specified.  (or if no directory was specified, the
           current directory.)

    -local True if the file physically resides on the local system.

    (expression)
           True if the parenthesized expression is true.  (Parentheses are
           special to the shell and must be escaped.)

    The primaries may be combined using the following operators (in the order
    of decreasing precedence):

    1.  The negation of a primary (! is the unary not operator).




  2                                              Intergraph Corporation - 2/94






  find(1)                             CLIX                             find(1)



    2.  Concatenation of primaries (the and operation is implied by the
        juxtaposition of two primaries).

    3.  Alternation of primaries (-o is the or operator).

  EXAMPLES

    1.  To remove all files named a.out or *.o that have not been accessed for
        a week:

        find / \( -name a.out -o -name '*.o' \) -atime +7 -exec rm {} \;


  FILES

    /etc/passwd

    /etc/group

  NOTES

    find / -depth always fails with the message:

    find:  stat failed:  No such file or directory.


  EXIT VALUES

    The find command returns a nonzero value if it fails.

  RELATED INFORMATION

    Commands: chmod(1), cpio(1), test(1), sh(1)

    Functions: stat(2), umask(2)

    Files: fs(4)

















  2/94 - Intergraph Corporation                                              3




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026