HP-UX Reference (11i v3 07/02) - 1 User Commands A-M (vol 1)
f
find(1) find(1)
Any command argument {} is replaced by the current path name. cmd may contain supplemen-
tary code set characters.
This example shows the difference between using
; and +. Two directories each have a file called,
hello. Directory one has one file:
$ls /one
hello
Directory /my/project/directory
has three files:
$ ls /my/project/directory
hello hi hummm
The following find commands search for the file named
hello in the directories:
$ find /one /my/project/directory -name hello -exec echo hi {} \+
hi /one/hello /my/project/directory/hello
$ find /one /my/project/directory -name hello -exec echo hi \;
hi
hi
When {} + is in the find command, echo hi executes only once. When ; is in the
find
command, echo hi executes for each match.
-follow
A position-independent term which causes
find to follow symbolic links. When following sym-
bolic links,
find keeps track of the directories visited so that it can detect infinite loops; for exam-
ple, such a loop would occur if a symbolic link pointed to an ancestor. This expression should not
be used with the -type l Expression. Always true.
-fsonly FStype
A position-independent term which causes
find to stop descending any directory whose file sys-
tem is not of the type specified by FStype, where FStype is one of
cdfs, hfs, vxfs,ornfs,
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
-fsonly hfs has been specified and find 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 -fsonly nfs has been specified, any HFS file systems that are
beneath the mount point of an NFS file system are not traversed. Always true.
-fstype FStype
True if the file system to which the file belongs is of type FStype, where FStype is one of
cdfs,
hfs, nfs,orvxfs corresponding to the CDFS, HFS, NFS, or JFS (VXFS) file system type,
respectively.
-group gname
True if the file belongs to the group gname.Ifgname is numeric and does not appear in the
/etc/group 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; +n
means more than n, -n means less than n, and n means exactly n.
-inum 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.
-linkedto path
True if the file is the same physical file as the file specified by path (i.e., linked to path). This pri-
mary is similar to
-inum, but correctly detects when a file is hard-linked to path, even when mul-
tiple file systems are searched.
-links n
True if the file has n links.
360 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: February 2007