The find command

The find command searches a directory tree for files that match the specified pattern. The command syntax is:

find [path...] [expression]

You must specify at least one path, but you do not have to specify an expression. If you do not specify an expression, find will print all files in the specified directories.

Common options:

-name
Specifies file name to search for. Can use regular expressions.
-type
Type of file to search for:

b
block special
c
character special
d
directory
p
named pipe (FIFO)
f
regular file
l
symbolic link
s
socket
-print
Prints file name to standard output (default).
-exec
Executes a command, substituting {} with the file name.
-xdev
Do not seach mounted file systems.
-o
Or operator.
-a
And operator.

Examples:


Next topic: xargs