A pathname of a starting point in the directory hierarchy.
Expressions
Valid expressions are:
-acl
True if the file have additional ACLs defined.
-amin n
File was last accessed n minutes ago.
-atime n
True if the file was accessed n days ago. The access time of directories in path is changed by find itself.
-cmin n
File's status was last changed n minutes ago.
-cpio device
Always true. Writes the current file on device in cpio format (5120-byte records).
-ctime n
True if the file's status was changed n days ago.
-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.
-exec command
True if the executed command returns a zero value as exit status. The end of command must be punctuated by an escaped semicolon ( ;). A command argument {} is replaced by the current pathname. If the last argument to -exec is {} and you specify + rather than the semicolon ( ;), the command is invoked fewer times, with {} replaced by groups of pathnames. If any invocation of the command returns a non-zero value as exit status, find returns a non-zero exit status.
-follow
Always true and always evaluated no matter where it appears in expression. The behavior is unspecified if -follow is used when the find command is invoked with either the -H or the -L option. 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 find-type l expression. See NOTES.
-fstype type
True if the filesystem to which the file belongs is of type type.
-group gname
True if the file belongs to the group gname. If gname is numeric and there's no such group name, it is taken as a group ID.
-groupacl gname
True if the file's ACL contains an entry for the group gname. If gname is numeric and there's no such group name, it is taken as a group ID.
-iname pattern
Like -name, but the match is case insensitive.
-inum n
True if the file has inode number n.
-ipath pattern
Like -path, but the match is case insensitive.
-iregex pattern
Like -regex, but the match is case insensitive.
-links n
True if the file has n links.
-local
True if the file system type is not a remote file system type as defined in the /etc/dfs/fstypes file. nfs is used as the default remote filesystem type if the /etc/dfs/fstypes file is not present. The -local option descends the hierarchy of non-local directories. See EXAMPLES for an example of how to search for local files without descending.
-ls
Always true. Prints current pathname together with its associated statistics. These include (respectively):
-
o
-
size in kilobytes (1024 bytes)
If the file is a special file, the size field instead contains the major and minor device numbers.
If the file is a symbolic link, the pathname of the linked-to file is printed preceded by `
→'. The format is identical to that of
ls -gilds (see
ls(1B)).
Formatting is done internally, without executing the
ls program.
-maxdepth n
Always true; descend at most n directory levels below the command line arguments. If any -maxdepth primary is specified, it applies to the entire expression even if it would not normally be evaluated. -maxdepth 0 limits the whole search to the command line arguments.
-mindepth n
Always true; do not apply any tests or actions at levels less than n. If any -mindepth primary is specified, it applies to the entire expression even if it would not normally be evaluated. -mindepth 1 processes all but the command line arguments.
-mmin n
File's data was last modified n minutes ago.
-mount
Always true. Restricts the search to the file system containing the directory specified. Does not list mount points to other file systems.
-mtime n
True if the file's data was modified n days ago.
-name pattern
True if
pattern matches the basename of the current file name. Normal shell file name generation characters (see
sh(1)) can 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.
Unless the character '
.' is explicitly specified in the beginning of
pattern, a current file name beginning with '
.' does not match
pattern when using
/usr/bin/find.
/usr/xpg4/bin/find does not make this distinction; wildcard file name generation characters can match file names beginning with '
.'.
-ncpio device
Always true. Writes the current file on device in cpio -c format (5120 byte records).
-newer file
True if the current file has been modified more recently than the argument file.
-nogroup
True if the file belongs to non-existing group.
-nouser
True if the file belongs to non-existing user.
-ok command
Like -exec, except that the generated command line is printed with a question mark first, and is executed only if the response is affirmative.
-path
Like -name, but matches the entire file path and not just basename.
-perm [
-]
mode
The
mode argument is used to represent file mode bits. It is identical in format to the symbolic mode operand,
symbolic_mode_list, described in
chmod(1), and is interpreted as follows. To start, a template is assumed with all file mode bits cleared. An
op symbol of:
+
Set the appropriate mode bits in the template
−
Clear the appropriate bits
=
Set the appropriate mode bits, without regard to the contents of the file mode creation mask of the process
The
op symbol of
− cannot be the first character of
mode, to avoid ambiguity with the optional leading hyphen. Since the initial mode is all bits off, there are no symbolic modes that need to use
− as the first character.
If the hyphen is omitted, the primary evaluates as true when the file permission bits exactly match the value of the resulting template.
Otherwise, if
mode is prefixed by a hyphen, the primary evaluates as true if at least all the bits in the resulting template are set in the file permission bits.
-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.
-print
Always true. Causes the current pathname to be printed.
-print0
Always true. Causes the current pathname to be printed, terminated by an ASCII NUL character (character code 0) instead of a newline.
-prune
Always yields true. Does not examine any directories or files in the directory structure below the pattern just matched. (See EXAMPLES). If -depth is specified, -prune has no effect.
-regex pattern
True if the full path of the file matches pattern using regular expressions.
-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.
-type c
True if the type of the file is c, where c is b, c, d, D, f, l, p, or s for block special file, character special file, directory, door, plain file, symbolic link, fifo (named pipe), or socket, respectively.
-user uname
True if the file belongs to the user uname. If uname is numeric and there's no such user name, it is taken as a user ID.
-useracl uname
True if the file's ACL contains an entry for the user uname. If uname is numeric and there's no such user name, it is taken as a user ID.
-xdev
Same as the -mount primary.
-xattr
True if the file has extended attributes.