Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ find(1) — UnixWare 2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1)

sh(1)

stat(2)

test(1)

umask(2)






       find(1)                                                      find(1)


       NAME
             find - find files

       SYNOPSIS
             find path-list [predicate-list]

       DESCRIPTION
             find recursively descends the directory hierarchy for each
             path name in the path-list (that is, one or more path names)
             seeking files that match a predicate-list, a boolean
             expression written in the primaries given below.  It processes
             supplementary code set characters, and recognizes
             supplementary code set characters in path-list and as
             described below, according to the locale specified in the
             LC_CTYPE environment variable [see LANG on environ(5)].
             Pattern searches are performed on characters, not bytes.  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:

             -name pattern
                          True if pattern matches the current file name.
                          Normal shell file name generation characters (see
                          sh(1)) may be used.  A backslash (\) is used as
                          an escape character within the pattern.  The
                          pattern should be escaped or quoted when find is
                          invoked from the shell.  pattern may contain
                          supplementary code set characters.

             -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 (-), only the bits that
                          are set in onum are compared with the file
                          permission flags, and the expression evaluates
                          true if they match.

             -perm [-]mode
                          The mode argument is used to represent file mode
                          bits. Its format is identical to the chmod
                          symbolic_mode operand and is interpreted in the
                          following manner.

       of + sets the




                           Copyright 1994 Novell, Inc.               Page 1













      find(1)                                                      find(1)


            A template is assumed, with all file mode bits cleared. An op symbol
                         appropriate mode bits in the template; - clears
                         the appropriate bits; and = sets the appropriate
                         mode bits, without regard to the contents of the
                         process's file mode creation mask. The op symbol
                         of - can't be the first character of mode.

      file permission bits match


            If the hyphen is omitted, the primary evaluates as true when the
                         the value of the resulting template exactly.
                         Otherwise, if mode has a hyphen prefix, the
                         primary evaluates as true if at least all the
                         bits in the resulting template are set in the
                         file permission bits.

            -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
                         bytes.

            -atime n     True if the file was accessed n days ago.  The
                         access time of directories in path-list is
                         changed by find itself.

            -mtime n     True if the file's data was modified n days ago.

            -ctime n     True if the file's status was changed n days ago.

            -exec cmd    True if the executed cmd returns a zero value as
                         exit status.  A command argument {} is replaced
                         by the current path name.  The end of cmd must be
                         punctuated by an escaped semicolon or a plus sign
                         (+).  When a plus sign is used, cmd aggregates a
                         set of pathnames and executes on the set; when a
                         semicolon is used, cmd executes on one pathname
                         at a time.  The reason for preferring + to a
                         semicolon is vastly improved performance.  cmd
                         may contain supplementary code set characters.
                         You can prepend the cmd with tfadmin if you need
                         to pass privileges to the cmd. This assumes that
                         an entry for you in the tfadmin database has been
                         previously defined.  The super-user will execute
                         the cmd with all privileges; prepending the
                         tfadmin is not necessary in this case.



                          Copyright 1994 Novell, Inc.               Page 2













       find(1)                                                      find(1)


             -ok cmd      Like -exec except that the generated command line
                          is printed with a question mark first.  This is a
                          prompt for confirmation.  It is executed if the
                          response is affirmative. The form of the
                          affirmative response is locale dependent: y in
                          the C locale, see LANG on environ(5).  cmd may
                          contain supplementary code set characters.

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

             -newer file  True if the current file has been 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(1) to transfer files that are contained
                          in directories without write permission.

             -mount       Always true; restricts the search to the file
                          system containing the directory specified.

             -local       True if the file physically resides on the local
                          system.  This does not restrict the search to
                          only files which physically reside on the local
                          system, it merely matches such files.  See
                          "Examples."

             -xdev [argument list]
                          True if you restrict your search to the root file
                          system. If you do not specify argument list, the
                          search will be made for every file on local and
                          remote networks.

             ( expression )
                          True if the parenthesized expression is true.

             -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 (named pipe), or plain file, respectively.





                           Copyright 1994 Novell, Inc.               Page 3













      find(1)                                                      find(1)


            -follow      Causes symbolic links to be followed.  When
                         following symbolic links, find keeps track of the
                         directories visited so that it can detect
                         infinite loops; for example, such a loop would
                         occur if a symbolic link pointed to an ancestor.
                         This expression should not be used with the -type
                         l expression.

            -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 taken as a
                         user ID.

            -nouser      True if the file belongs to a user not in the
                         /etc/passwd file.

            -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 taken as a group ID.

            -nogroup     True if the file belongs to a group not in the
                         /etc/group file.

            -fstype  type
                         True if the file system to which the file belongs
                         is of type type.

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

            -prune       Always yields true.  Do not examine any
                         directories or files in the directory structure
                         below the expression just matched.  See the
                         examples, below.

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

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

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





                          Copyright 1994 Novell, Inc.               Page 4













       find(1)                                                      find(1)


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

             Note that when you use find in conjunction with cpio, if you
             use the -L option with cpio then you must use the -follow
             expression with find and vice versa.  Otherwise there will be
             undesirable results.

             If no expression is present, -print is used as the expression.
             Otherwise, if the given expression does not contain any of the
             primaries -exec, -ok, or-print, the given expression can be
             replaced by (given_expression) -print.  The -user, -group, and
             -newer primaries each evaluate their respective arguments
             once.

       EXAMPLES
             Remove all files in your home directory named a.out or *.o
             that have not been accessed for a week:
             find $HOME \( -name a.out -o -name '*.o' \) -atime +7 -exec rm {} \;

             Recursively print all file names in the current directory and
             below, but skipping SCCS directories:
                   find . -name SCCS -prune -o -print

             Recursively print all file names in the current directory and
             below, skipping the contents of SCCS directories, but printing
             out the SCCS directory name:
                   find . -print -name SCCS -prune

             Match only local files, and don't examine the contents of any
             directory found to be remotely mounted:
                   find /  ! -local -prune -o -size +50 -print

             This only works correctly if there are no local file systems
             mounted on top of remote directories. This example will print
             all local files on the system larger than 50 blocks, without
             wasting time accessing remote files.

             To get the same effect, but to check for files in local file
             systems mounted on remote directories, use:
                   find / -local -size +50 -print

       FILES
             /etc/passwd
             /etc/group




                           Copyright 1994 Novell, Inc.               Page 5













      find(1)                                                      find(1)


            /usr/lib/locale/locale/LC_MESSAGES/uxcore.abi
                  language-specific message file [See LANG on environ
                  (5).]

      REFERENCES
            chmod(1), sh(1), stat(2), test(1), umask(2)

      NOTICES
            When using find to determine files modified within a range of
            time, one must use the ?time argument before the -print
            argument otherwise find will give all files.

            The following option is obsolete and will not be supported in
            future releases.

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































                          Copyright 1994 Novell, Inc.               Page 6








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