find


find

Purpose

Display a list of files that match a specified set of criteria.

Syntax

find [path] [options]

Options

-depth processes the current directory first, then subdirectories.

-maxdepth n restricts searches to n levels of directories.

-follow processes directories included through symbolic links.

-name pattern finds files whose names match the pattern.

-ctime n matches files modified exactly n days ago.

-user uname finds files the specified user owns.

-group gname finds files the specified group owns.

-path pattern finds files whose pathname matches the pattern.

-perm mode finds files with the specified permission setting.

-size +nK finds files bigger than n kilobytes.

-type x finds files of a specified type, where x is one of the following:

f matches files.

d matches directories.

l matches symbolic links.

-print displays the names of the files found.

-exec command [options] {} \; executes the specified command by passing it the name of the file that was found.

Description

The find command is useful for finding all files that match a specified set of criteria. If you type find without any arguments, the output is a listing of every file in all subdirectories of the current directory. To view all files whose names end with .gz, type find . -name “*.gz”.