find (find files)

Searches specified directories for files or groups of files.

Format:    find directories conditions
Examples:  find /home/janet -name "file*.txt" -print
           find . -type d -print

The first example searches the directory /home/janet, and all its subdirectories, for any files that begin with file and end with .txt. The filenames are displayed. The second example searches the current directory, and its subdirectories, for directories and displays their names.

Rather than options, find uses conditions that are listed after the argument (the path to search). Some conditions are:

ConditionWhat It DoesExample
-amin +n|-n|nFind files with last access date more than, less than, or n minutes agofind . -amin +30
-anewer filenFind files accessed ...

Get Spring Into Linux® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.