find—Search for files in a directory hierarchy
find [path…] [expression]
This manual page documents the GNU version of find. find searches the directory tree rooted at each given filename by evaluating the given expression from left to right, according to the rules of precedence (see “Operators,” later in this manual page), until the outcome is known (the left side is False for AND operations, True for OR), at which point find moves on to the next filename.
The first argument that begins with –, (, ), ,, or ! is taken to be the beginning of the expression; any arguments before it are paths to search, and any arguments after it are the rest of the expression. If no paths are given, the current directory is used. If no expression is given, the expression –print is used.
find exits with status 0 if all files are processed successfully, greater than 0 if errors occur.
The expression is made up of options (which affect overall operation rather than the processing of a specific file, and always return True), tests (which return a True or False value), and actions (which have side effects and return a True or False value), all separated by operators. –and is assumed where the operator is omitted. If the expression contains no actions other than – prune, –print is performed on all files for which the expression is true.
All options always return True. They always take effect, rather than being processed only when their place in the expression is reached. Therefore, for clarity, it is best to place them at the beginning of the expression.
|–daystart||Measure times (for –amin, –atime, –cmin, –ctime, –mmin, and –mtime) from the beginning of today rather than from 24 hours ago.|
|–depth||Process each directory’s contents before the directory itself.|
|–follow||Dereference symbolic links. Implies –noleaf.|
|–help, —help||Print a summary of the command-line usage of find and exit.|
|–maxdepth levels||Descend at most levels (a nonnegative integer) levels of directories below the command-line arguments. –maxdepth 0 means only apply the tests and actions to the command-line arguments.|
|–mindepth levels||Do not apply any tests or actions at levels less than levels (a nonnegative integer). –mindepth 1 means process all files except the command-line arguments.|
|–mount||Don’t descend directories on other filesystems. An alternate name for –xdev, for compatibility with some other versions of find.|
|–noleaf||Do not optimize by assuming that directories contain two fewer subdirectories than their hard link count. This option is needed when searching filesystems that do not follow the UNIX directorylink convention, such as CD-ROM or MS-DOS filesystems or AFS volume mount points. Each directory on a normal UNIX filesystem has at least 2 hard links: its name and its . entry. Additionally, its subdirectories (if any) each have a .. entry linked to that directory. When find is examining a directory, after it has statted two fewer subdirectories than the directory’s link count, it knows that the rest of the entries in the directory are nondirectories (leaf files in the directory tree). If only the files’ names need to be examined, there is no need to stat them; this gives a significant increase in search speed.|
|–version, —version||Print the find version number and exit.|
|–xdev||Don’t descend directories on other filesystems.|