Name

find

Synopsis

find [pathnames] [conditions]

Description

An extremely useful command for finding particular groups of files (numerous examples follow this description). find descends the directory tree beginning at each pathname and locates files that meet the specified conditions. The default pathname is the current directory. The most useful conditions include -print (which is the default if no other expression is given), -name and -type (for general use), -exec and -size (for advanced users), and -mtime and -user (for administrators).

Conditions may be grouped by enclosing them in \( \) (escaped parentheses), negated with ! (use \! in the C shell), given as alternatives by separating them with -o, or repeated (adding restrictions to the match; usually only for -name, -type, -perm). Modification refers to editing of a file’s contents. Change refers to modification, permission or ownership changes, and so on; therefore, for example, -ctime is more inclusive than -atime or -mtime.

Conditions and actions

-atime + n | - n | n

Find files that were last accessed more than n (+ n), less than n (- n), or exactly n days ago. Note that find changes the access time of directories supplied as pathnames.

-ctime + n | - n | n

Find files that were changed more than n (+ n), less than n (- n), or exactly n days ago. A change is anything that changes the directory entry for the file, such as a chmod.

-depth

Descend the directory tree, skipping directories and working on actual files first (and ...

Get Linux in a Nutshell, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.