O'Reilly logo

Linux in a Nutshell, Fourth Edition by Aaron Weber, Stephen Figgins, Ellen Siever

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

find

Synopsis

                  find [pathnames] [conditions]

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 use), and -mtime and -user (for administrators).

Conditions may be grouped by enclosing them in \( \) (escaped parentheses), negated with ! (use \! in tcsh), given as alternatives by separating them with -o, or repeated (adding restrictions to the match; usually only for -name, -type, or -perm). Note that “modification” refers to editing of a file’s contents, whereas “change” means a modification, or permission or ownership changes. In other words, -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 then the parent ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required