hpux man page for find

Query: find

OS: hpux

Section: 1

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

find(1) 						      General Commands Manual							   find(1)

NAME
find - find files
SYNOPSIS
pathname_list [expression]
DESCRIPTION
The command recursively descends the directory hierarchy for each path name in pathname_list (that is, one or more path names) seeking files that match a Boolean expression written in the primaries given below. By default, does not follow symbolic links; see The Boolean expression is evaluated using short-circuit evaluation. This means that whenever the result of a Boolean operation (AND or OR) is known from evaluating the left-hand argument, the right-hand argument is not evaluated. In the descriptions of the primaries, the argument n represents a decimal integer; means more than n, means less than n, and n means exactly n. Options The command recognizes the following options: For each symbolic link specified in pathname_list on the command line, the command evaluates the file information and file type of the file referenced by the symbolic link, and not the link itself. If the file referenced by symbolic link does not exist, the command evaluates the file information and file type for the link itself. For all symbolic links not on command line, the command evaluates the file information and file type for the link itself. For each symbolic link specified on the command line in pathname_list or encountered in the file hierarchy, the command evaluates the file information and file type of the file referenced by symbolic link, and not the link itself. Primaries The command recognizes the following primaries which are used in the Boolean expression: True if the file access time subtracted from the initialized time is n-1 to n multiples of 24 h. The initialization time shall be a time between the invocation of the utility and the first access by that invocation of the utility to any file specified by its operands. The access time of directories in pathname_list is changed by itself. Write the current file on device in cpio(4) format (5120-byte records). The use of implies Always true. True if the time of last change of file status information subtracted from the initialization time is n-1 to n multiples of 24 h. The initialization time shall be a time between the invocation of the util- ity and the first access by that invocation of the utility to any file specified by its operands. A position-independent term which 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 is used with (see cpio(1)) to transfer files that are contained in directories without write permission. It is also useful when using and the modification dates of directories must be preserved. Always true. True if the executed cmd returns a zero value as exit status. The end of cmd must be punctuated by a semicolon or a plus sign The semicolon and plus are special to the shell and must be escaped with a backslash When is used, cmd aggregates a set of path names and executes on the set. Any command arguments between the first occurrence of curly braces and plus sign are ignored. In the UNIX 2003 environment, indicates end of cmd, only if immediately follows The reason for preferring to a is improved performance. With the the command in executes for each match that the command finds. However, with the command executes only once. Any command argument is replaced by the current path name. cmd may contain supplementary code set characters. This example shows the difference between using and Two directories each have a file called, Directory has one file: Directory has three files: The following commands search for the file named in the directories: When is in the command, executes only once. When is in the command, executes for each match. A position-independent term which causes to follow symbolic links. When following symbolic links, 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 Expression. Always true. A position-independent term which causes to stop descending any directory whose file system is not of the type specified by FStype, where FStype is one of or representing the CDFS, HFS, JFS (VXFS), or NFS file system type, respectively. In this context, mount points inherit the FStype of their parent directory. This means that when has been specified and encounters an NFS mount point that is mounted on an HFS file system, the mount point will be visited but entries below that mount point will not. It is important to note that when has been specified, any HFS file systems that are beneath the mount point of an NFS file system are not traversed. Always true. True if the file system to which the file belongs is of type FStype, where FStype is one of or corresponding to the CDFS, HFS, NFS, or JFS (VXFS) file system type, respectively. True if the file belongs to the group gname. If gname is numeric and does not appear in the file, it is taken as a group ID. The gname operand can be preceded by a or to modify the comparison of the primaries. If the argument n represents a decimal integer; means more than n, means less than n, and n means exactly n. True if the file serial number (inode number) is n. Note that file serial numbers are unique only within a given file system. Therefore, matching file serial numbers does not guarantee that the referenced files are the same unless you restrict the search to a single file system. True if the file is the same physical file as the file specified by path (i.e., linked to path). This primary is similar to but correctly detects when a file is hard-linked to path, even when multi- ple file systems are searched. True if the file has n links. 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 Identical to This primary is provided for backward compatibility only. is preferred over True if the file modification time subtracted from the initialization time is n-1 to n multiples of 24 h. The initialization time shall be a time between the invocation of the utility and the first access by that invocation of the utility to any file specified in its operands. True if pattern file matches the last component of the current file name. Pattern is matched according to Pattern Matching Notation for file name expansion. Pattern should be escaped (using backslash) or quoted when is invoked from the shell, to prevent the shell from expand- ing any metacharacters. Pattern may contain supplementary code set characters. Same as but adds the option to The use of implies Always true. True if the current file has been modified more recently than the argument file. True if the indicated time value (tv1) of the current file is newer than the indicated time value (tv2) of file. The time values tv1 and tv2 are each selected from the set of characters: The time the file was last accessed The time the inode of the file was last modified The time the file was last modified If the tv2 character is omitted, it defaults to Note that the option is equivalent to Syntax examples; True if the file belongs to a group ID that is not listed in the group database. See group(4). True if the file belongs to a user ID that is not listed in the password database. See passwd(4). Same as except that the generated command line is printed with a question mark first, and is executed only if the user responds by typing The form of the affirmative response is locale dependent: y in the C locale, see on environ(5). The end of cmd must be punctuated by a semicolon (semicolon is special to the shell and must be escaped). cmd may contain supplementary code set characters. This is a positive-logic version of A is performed after every directory, unless is successfully evaluated for that directory. As an example, the following three com- mands are equivalent: Note, however, that is useless if the option has also been given. Always true. Same as except the full path (as would be output by is used instead of just the base name. Note that characters are not treated as a spe- cial case. For example, matches Causes the current path name to be printed followed by a newline character. Always true. Causes the current path name to be printed followed by a null character. Always true. In this primary, the argument mode is used to represent file mode bits. The argument is identical in format to the mode operand as described in chmod(1), with the exception that the first character must not be the operator. When using the symbolic form of mode, the starting template is assumed to have all file mode bits cleared. If the leading minus is omitted, this primary is true when the file permission bits exactly match the value of mode. Bits associ- ated with the symbolic attributes (set-user-ID, set-group-ID) and (sticky bit) are ignored when the minus is omitted. If mode is preceded by a minus, this primary is true if all of the bits that are set in mode are also set in the file permission bits. In this case, the bits associated with the symbolic attributes and are significant. If the current entry is a directory, cause to skip that directory. This can be useful to avoid walking certain directories, or to avoid recursive loops when using Note, how- ever, that is useless if the option has also been given. See the description of and the section, below, for more information. Always true. True if the file is n blocks long (512 bytes per block). If n is followed by a the size is in bytes. True if the type of the file is c, where c is one of the following: Block special file Character special file Directory Regular file Symbolic link Mount point Network special file FIFO (named pipe) Socket True if the file belongs to the user uname. If uname is numeric and does not appear as a login name in the file, it is taken as a user ID. The uname operand can be preceded by a or to modify the comparison of the primaries. If the argument n represents a decimal integer; means more than n, means less than n, and n means exactly n. A position-independent term that causes to avoid crossing any file system mount points that exist below starting points enumerated in pathname_list. The mount point itself is visited, but entries below the mount point are not. Always true. True if the parenthesized expression is true. The spaces are required. Parentheses are special to the shell and must be escaped, as in and Primaries can be combined by using the following operators (in order of decreasing precedence): Logical AND operator. True if both of the expressions are true. Logical OR operator. True if either or both of the expressions are true. Logical NOT operator. True if expression is not true. If expression is omitted, or if none of or is specified, is assumed. The and primaries each evaluate their respective arguments once. HFS Access Control Lists The primary enables the user to search for HFS access control list entries. It is true if the file's access control list matches an access control list pattern or contains optional access control list entries (see acl(5)). It has three forms: Match all files whose access control list includes all (zero or more) pattern entries specified by the aclpatt pattern. Match a file only if its access control list includes all (zero or more) pattern entries specified by the aclpatt pattern, and every entry in its access con- trol list is matched by at least one pattern entry specified in the aclpatt pattern. Match all files containing optional access control list entries. The aclpatt string can be given as an operator or short form pattern; see acl(5). By default, is true for files whose access control lists include all the (zero or more) access control list patterns in aclpatt. A file's access control list can also contain unmatched entries. If aclpatt begins with the remainder of the string must match all entries in a file's access control list. The aclpatt string (by default, or the part following can be either an access control list or an access control list pattern. However, if it is an access control list, aclpatt must include at least the three base entries ((user.%, mode), (%.group, mode), and (%.%, mode)). As a special case, if aclpatt is the word the primary is true for files with access control list entries. JFS Access Control Lists The primary enables the user to search for JFS access control list entries. It is true if the file's access control list matches an access control list pattern or contains optional access control list entries (see aclv(5)). It has three forms: Match all files whose access control list includes all (zero or more) pattern entries specified by the aclpatt pattern. Match a file only if its access control list includes all (zero or more) pattern entries specified by the aclpatt pattern, and every entry in its access con- trol list is matched by at least one pattern entry specified in the aclpatt pattern. Match all files containing optional access control list entries. By default, is true for files whose access control lists include all the (zero or more) access control list patterns in aclpatt. A file's access control list can also contain unmatched entries. If aclpatt begins with the remainder of the string must match all entries in a file's access control list. An aclpatt consists of a type field, an ID field, and a mode field, separated by colons. Multiple comma-separated aclpatts may be speci- fied. The type field is one of or optionally preceded by and can be abbreviated to and respectively. A type field of matches any of the above types. The ID field is either a numeric user or group ID, a user or group ID string from or respectively, or which matches any ID. The ID field can be mentioned only if the type field matches any of or The mode field consists of a string of three characters. The first character is either indicating that read permission is granted; indi- cating that read permission is denied; or which matches either state of read permission. The second character is either or similarly indi- cating the state of write permission; and the third character is either or indicating the state of execute permission. As a special case, if aclpatt is the word the primary is true for files with optional access control list entries.
EXTERNAL INFLUENCES
Environment Variables If an internationalization variable is not specified or is null, it defaults to the value of If is not specified or is null, it defaults to (see lang(5)). If is set to a nonempty string value, it overrides the values of all the other internationalization variables. If any internationalization variable contains an invalid setting, all internationalization variables default to (see environ(5)). determines the interpretation of text as single and/or multibyte characters, the classification of characters as printable, and the charac- ters matched by character class expressions in regular expressions. determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informa- tive messages written to standard output. determines the location of message catalogues for the processing of International Code Set Support Single- and multibyte character code sets are supported.
EXAMPLES
Here are several examples. o The following examples show using and options. is a symbolic link which points to a directory The following command lists the filenames which are type directories. is not printed by default. The following command uses the option. Because is not found on the command line, it is not followed and not treated as a directory. The following command uses the option. Although is not found on the command line, the option causes all the symbolic links encountered anywhere in the file hierarchy to be followed. In the following example, the symbolic link, is on the command line, so it is followed and recognized as a type o Search two directories, and for files containing the string and print the names of the files: o Remove all files named or that have not been accessed for a week: Note that the spaces delimiting the escaped parentheses are required. o Print a single long listing of all files named in the current directory: Note that the curly braces, before plus sign, are optional. o Print the names of all files on this machine. Avoid walking directories while still printing the mount points: o Match only local files, and do not examine the contents of any directory found to be remotely mounted: 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. o To get the same effect, but to check for files in local file systems mounted on remote directories, use: o Copy the entire file system to a disk mounted on avoiding the recursive copy problem. Both commands are equivalent (note the use of instead of o Copy the root disk to a disk mounted on skipping all mounted file systems below Note that does not cause to be skipped, even though it is a mount point. This is because is the starting point and only affects entries starting points. o Change permissions on all regular files in a directory subtree to mode 444, and permissions on all directories to 555: Note that output from was piped to xargs(1) instead of using the primary. This is because when a large number of files or directo- ries is to be processed by a single command, the primary spawns a separate process for each file or directory, whereas xargs col- lects file names or directory names into multiple arguments to a single chmod command, resulting in fewer processes and greater sys- tem efficiency. The delimiter for the primary can be used to achieve the same efficiency. Access Control List Examples The following examples are for Access Control Lists. o Find all files not owned by user that have access control lists with at least one entry associated with and one entry for no specific user in group with the read bit on and the write bit off: o Find all files that have a read bit set in any access control list entry: o Find all files that have the write bit unset and execute bit set in every access control list entry: o Find all files that have optional access control list entries:
DEPENDENCIES
NFS The primary is always false for NFS files.
WARNINGS
Because of interoperability goals, does not support archiving files larger than 2GB or files that have user/group IDs larger than 60,000 (60K). Files with user/group IDs greater than 60K are archived and restored under the user/group ID of the current process.
AUTHOR
was developed by AT&T and HP.
FILES
Group names Mount points User names
SEE ALSO
chacl(1), chmod(1), cpio(1), setacl(1), sh(1), test(1), xargs(1), mknod(2), stat(2), cpio(4), group(4), passwd(4), acl(5), aclv(5), envi- ron(5), lang(5), regexp(5).
STANDARDS CONFORMANCE
find(1)
Similar Topics in the Unix Linux Community
find the highest number in the file
finding idle time of a process
Bash can't find file but tcsh can why?
Help finding a Unix friendly RAID 1 backup
Need help on find and replacement on specific line and position