📄 a
字号:
find(1) find(1) NAME find - find files SYNOPSIS find pathname_list [expression] DESCRIPTION The find 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, find does not follow symbolic links. 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; +n means more than n, -n means less than n, and n means exactly n. The following primaries are recognized: -depth 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 find is used with cpio(1) to transfer files that are contained in directories without write permission. It is also useful when using cpio(1) and the modification dates of directories must be preserved. Always true. -follow A position-independent term which causes find to follow symbolic links. 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. Always true. -fsonly FStype A position-independent term which causes find to stop descending any directory whose file system is not of the type specified by FStype, where FStype is one of cdfs, hfs, vxfs, or nfs, representing the CDFS, HFS, JFS (VXFS) or NFS file system type, respectively. Hewlett-Packard Company - 1 - HP-UX Release 11i: November 2000 find(1) find(1) 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. -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 A position-independent term that causes find 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. -mountstop Identical to -xdev. This primary is provided for backward compatibility only. -xdev is preferred over -mountstop. -name file True if file matches the last component of the current file name. The matching is performed according to Pattern Matching Notation (see regexp(5)). Pattern may contain supplementary code set characters. -path file Same as -name except the full path (as would be output by -print) is used instead of just the base name. Note that / characters are not treated as a special case. For example, */.profile matches ./home/fred/.profile. -perm [-]mode 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. Hewlett-Packard Company - 2 - HP-UX Release 11i: November 2000 find(1) find(1) If the leading minus is omitted, this primary is true when the file permission bits exactly match the value of mode. Bits associated with the symbolic attributes s (set-user-ID, set-group-ID) and t (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 s and t are significant. -fstype FStype True if the file system to which the file belongs is of type FStype, where FStype is one of cdfs, hfs, or nfs, corresponding to the CDFS, HFS, or NFS file system type, respectively. -type c True if the type of the file is c, where c is one of: f Regular file d Directory b Block special file c Character special file p FIFO (named pipe) l Symbolic link s Socket n Network special file M Mount point -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. The uname 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. -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. 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 Hewlett-Packard Company - 3 - HP-UX Release 11i: November 2000 find(1) find(1) means less than n, and n means exactly n. -nouser True if the file belongs to a user ID that is not listed in the password database. See passwd(4). -nogroup True if the file belongs to a group ID that is not listed in the group database. See group(4). -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 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 find utility and the first access by that invocation of the find utility to any file specified by its path operands. The access time of directories in pathname_list is changed by find itself. -mtime n 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 find utility and the first access by that invocation of the find utility to any file specified in its path operands. -ctime n 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 find utility and the first access by that invocation of the find utility to any file specified by its path operands. -newer file True if the current file has been modified more recently than the argument file. -newer[tv1[tv2]] 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: Hewlett-Packard Company - 4 - HP-UX Release 11i: November 2000 find(1) find(1) a The time the file was last accessed c The time the inode of the file was last modified m The time the file was last modified If the tv2 character is omitted, it defaults to m. Note that the -newer option is equivalent to -newermm. Syntax examples; -newera file -newermc file -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 primary is similar to -inum, but correctly detects when a file is hard-linked to path, even when multiple file systems are searched. -print Causes the current path name to be printed. Always true. -exec cmd 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 (+) (semicolon and plus are special to the shell and must be escaped). When a plus sign is used, cmd aggregates a set of pathnames and executes on the set. The reason for preferring + to a semicolon is vastly improved performance. Any command argument {} is replaced by the current path name. cmd may contain supplementary code set characters. -ok cmd Same as -exec except that the generated command line is printed with a question mark first, and is executed only if the user responds by typing y. The form of the affirmative response is locale dependent: y in the C locale, see LANG on environ(5). cmd Hewlett-Packard Company - 5 - HP-UX Release 11i: November 2000 find(1) find(1) may contain supplementary code set characters. -cpio device Write the current file on device in cpio(4) format (5120-byte records). The use of -cpio implies -depth. Always true. -ncpio Same as -cpio but adds the -c option to cpio. The use of -ncpio implies -depth. Always true. -prune If the current entry is a directory, cause find to skip that directory. This can be useful to avoid walking certain directories, or to avoid recursive loops when using cpio -p. Note, however, that -prune is useless if the -depth option has also been given. See the description of -only and the EXAMPLES section, below, for more information. Always true. -only This is a positive-logic version of -prune. A -prune is performed after every directory, unless -only is successfully evaluated for that directory. As an example, the following three commands are equivalent:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -