find(1) MPE/iX Shell and Utilities find(1)
______________________________________________________________________
NAME
find -- find files within file tree
SYNOPSIS
find directory ... expression
DESCRIPTION
Note: The MPE/iX implementation of this utility does not function
exactly as this man page describes. For details, see the MPE/iX
NOTES section at the end of this man page.
find walks down the given file hierarchy starting at directory,
and finds files which match the criteria given by expression.
Each directory, file, and special file is checked against expres-
sion. If you use the -exec, -ok, or -cpio primaries, expression
has the side-effect of invoking a specified command on each file
found. A non-existent expression or an expression with no side-
effects automatically uses the -print primary to display the name
of any file that matches the criteria of expression.
find builds expression from a set of primaries and operators;
juxtaposition of two primaries implies logical AND operator. You
can group primaries and operators using parentheses.
Note: Parentheses are shell metacharacters. To use them in
expression, you must quote them.
You must delimit all primaries, operators, numbers, arguments,
and parentheses with white space. Each number noted in the pri-
mary list is a decimal number, optionally preceded by a plus (+)
or minus (-) sign. If a number is given without a sign, find
tests for equality; a plus sign implies greater than or older
than and a minus sign implies less than or newer than.
Operators
find accepts the following operators:
-a Use between primaries for logical AND. This operator can be
omitted with the same result since logical AND is assumed
when no operator is used between two primaries.
-o Use between primaries for logical OR.
! Precede expression with this operator to negate it.
Primaries
find accepts the following primaries:
-atime number
matches if someone accessed the file during the 24-hour
period beginning number days ago.
1
find(1) MPE/iX Shell and Utilities find(1)
______________________________________________________________________
-cpio cpio-file
writes the file found to the target file cpio-file in cpio
format. This is equivalent to
find ... | cpio -o >cpio-file
This primary matches if the command succeeds.
-ctime number
matches if someone changed the attributes of the file during
the 24-hour period beginning number days ago.
-depth
processes directories after their contents. If present,
this primary always matches.
-exec command ;
takes all arguments between -exec and the semicolon as a
command line, replacing any argument which is exactly {}
(that is, the two brace characters) with the current path
name. It then executes the resulting command line, treating
a return status of zero from this command as a successful
match, non-zero as failure. You must delimit the terminal
semicolon with white space.
Note: The semicolon is a shell metacharacter. To use it in
expression, you must quote it.
-follow
follows symbolic links. If present, this primary always
matches.
group name
matches if the group owner is name. If name is not a valid
group name, it is treated as a group ID.
-inum number
matches if the file has inode number number.
-level number
does not descend below number levels.
-links number
matches if there are number links to the file.
-mtime number
matches if someone modified the file during the 24-hour
period beginning number days ago.
2
find(1) MPE/iX Shell and Utilities find(1)
______________________________________________________________________
-name pattern
compares the current file name to pattern. If there is no
match, expression fails. The pattern uses the same syntax
as file name generation (see sh(1)). It attempts to match as
many trailing path name components as specified in pattern.
-ncpio cpio-file
writes the file found to the target file cpio-file in cpio
-c format. This is equivalent to
find ... | cpio -oc >cpio-file
This primary matches if the command succeeds.
-newer file
compares the modification date of the found file to that of
the file given. This matches if someone has modified the
found file more recently than file.
-nogroup
matches if no group with a name in the group database owns
the file.
-none
indicates that some action has been taken; thus find does
not invoke the default -print action. If present, this pri-
mary always matches.
-nouser
matches if no user with a name in the user database owns the
file.
-ok command ;
is similar to -exec, but before find executes the command,
it displays the command to confirm that you want to go
ahead. find only executes the command line if your input
matches the expression for yes (yes and no expressions are
defined in LC_MESSAGES). If you type the expression for no,
the primary does not match. You must delimit the terminal
semicolon with white space.
Note: The semicolon is a shell metacharacter. To use it in
expression, you must quote it.
-perm [-]mask
by default, matches if the permissions on the file are iden-
tical to the ones given in mask. You may specify mask in
octal or in symbolic mode (see chmod(1)). If you use sym-
bolic mode, find assumes that you begin with no bits set in
mask, and the symbolic mode is a recipe for turning the bits
you want on and off. A leading minus sign (-) is special.
It means that a file matches if at least all the bits in
3
find(1) MPE/iX Shell and Utilities find(1)
______________________________________________________________________
mask are set. As a result, with symbolic mode, you cannot
use a mask value which begins with a minus sign (-).
If you use octal mode, find only uses the bottom twelve bits
of the mask. With an initial minus sign (-), find again
matches only if at least all the limits in mask are set in
the file permissions lists.
-print
displays the current file name. This primary always matches.
-prune
stops traversing deeper into the tree at this point. If
present, this primary always matches. -prune has no effect
if -depth is also specified.
-size number[c]
matches if the size of the file is number blocks long, where
a block is 512 bytes. If you include the suffix c, the file
size is number bytes.
-type c
matches if the type of the file is the same as the type
given by the character c. Possible values of the character
are:
b -- block-special
c -- char-special
d -- directory
f -- regular file
l -- symbolic link
n -- network file
p -- FIFO (named pipe)
s -- socket
-user name
matches if the owner of the file is name. Name can also be a
user ID number.
-xdev
does not cross device boundaries from the root of the tree
traversal. If present, this primary always matches.
ENVIRONMENT VARIABLES
find uses the following environment variable:
PATH
determines the location of the command specified with the
-exec or -ok primaries.
DIAGNOSTICS
Possible exit status values are:
4
find(1) MPE/iX Shell and Utilities find(1)
______________________________________________________________________
0 Successful completion.
1 An error occurred.
Messages
Message: "-type c" is invalid
Cause: You specified the -type primary but did not follow with
a valid character to represent the file type.
Action: Check the DESCRIPTION section for a list of valid char-
acters for use with the -type primary.
Message: bad number specification in "string"
Cause: You specified an option that takes a numeric value (for
example, -atime, -ctime), but you did not specify a
valid number after the option.
Action: Ensure that options that take a numeric value are fol-
lowed by a valid number (only decimal digits, preceding
by an optional plus or minus sign).
Message: cannot access file "filename": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: cannot execute "filename": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: cannot stat file "filename" for -newer: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: error reading directory "pathname"
Cause: You attempted to read the directory pathname. You do
not have read permissions on this directory.
Action: If you need to access the directory pathname, see your
system manager about acquiring read permissions for
that directory. If you do not need to access it, no
corrective action is required.
Message: group name "name" is unknown
Cause: You specified the -group primary but did not specify a
valid group name.
Action: Specify a valid group name after the -group primary.
Message: Insufficient memory
Cause: There were not enough free system resources to perform
the specified operation.
Action: Free up more resources.
Message: must specify a command after -exec/-ok
Cause: You specified either the -exec or the -ok primary
5
find(1) MPE/iX Shell and Utilities find(1)
______________________________________________________________________
without specifying a command to be performed.
Action: Provide the missing command.
Message: must specify option after -primary
Cause: You specified -primary, but did not provide the argu-
ment that it requires.
Action: Specify a valid argument after -primary.
Message: non-terminated "primary" argument list
Cause: You specified the -exec or -ok primary and did not ter-
minate the argument list following it with a semicolon
(;).
Action: Terminate the argument list following -exec or -ok with
a semicolon.
Message: Octal mode may contain only digits [0-7] in numstring
Cause: When using the octal mode to indicate new access per-
missions, you specified a string numstring which con-
tained a character other than the digits 0 to 7.
Action: Ensure that all octal mode values are valid octal num-
bers.
Message: unable to access "pathname": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: unable to allocate memory for expression tree
Cause: find requires system resources to build an expression
tree. There were not enough free resources to do so.
Action: Free up more system resources or specify a less complex
expression.
Message: Unknown option "-option"
Cause: You specified an option that is not valid for find.
Action: Check the DESCRIPTION section for a list of valid find
options.
Message: Unknown or missing operator in symbolic mode "mode-
string"
Cause: When using the symbolic mode to indicate new access
permissions, you specified a string modestring which
had either a missing or unrecognized operator.
Action: Make sure that all mode values in symbolic mode contain
one of the following operators: +, -, or =.
Message: user name "user" is unknown
Cause: You specified the -user primary, but did not provide a
valid user name.
Action: Provide a valid user name after the -user primary.
Message: write error on standard output: system error
Cause: See syserror(3).
Action: See syserror(3).
6
find(1) MPE/iX Shell and Utilities find(1)
______________________________________________________________________
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems.
Most UNIX systems do not have a default action of -print; hence,
they do not need the -none option. The -a operator is undocu-
mented on many UNIX systems. The -cpio, -follow, -inum, -level,
-ncpio, and -none primaries are extensions to the POSIX standard.
MPE/iX NOTES
This release of MPE/iX does not provide the lstat() API. As a
result, this command cannot return information on the link
itself. It attempts to determine when a symbolic link has been
referenced, but can only return the information on the target of
the link, rather than the link itself.
For more information on how the current MPE/iX implementation may
affect the operation of this utility, see Appendix A, MPE/iX
Implementation Considerations.
SEE ALSO
chmod(1), cpio(1), sh(1)
7