Next: , Up: Reference



7.1 Invoking find

     find [-H] [-L] [-P] [file...] [expression]

find searches the directory tree rooted at each file name file by evaluating the expression on each file it finds in the tree.

The options -H, -L or -P may be specified at the start of the command line (if none of these is specified, -P is assumed). The arguments after these are a list of files or directories that should be searched.

This list of files to search is followed by a list of expressions describing the files we wish to search for. The first part of the expression is recognised by the fact that it begins with -, (, ), ,, or !. Any arguments after it are the rest of the expression. If no paths are given, the current directory is used. If no expression is given, the expression -print is used.

find exits with status 0 if all files are processed successfully, greater than 0 if errors occur.

Three options can precede the list of path names. They determine the way that symbolic links are handled.

-P
Never follow symbolic links (this is the default), except in the case of the -xtype predicate.
-L
Always follow symbolic links, except in the case of the -xtype predicate.
-H
Follow symbolic links specified in the list of paths to search, or which are otherwise specified on the command line.

If find would follow a symbolic link, but cannot for any reason (for example, because it has insufficient permissions or the link is broken), it falls back on using the properties of the symbolic link itself. Symbolic Links for a more complete description of how symbolic links are handled.

See Primary Index, for a summary of all of the tests, actions, and options that the expression can contain. If the expression is missing, -print is assumed.

find also recognizes two options for administrative use:

--help
Print a summary of the command-line argument format and exit.
--version
Print the version number of find and exit.