Next: , Up: Reference


7.1 Invoking find

     find [-H] [-L] [-P] [-D debugoptions] [-Olevel] [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 command line may begin with the ‘-H’, ‘-L’, ‘-P’, ‘-D’ and ‘-O’ options. These are followed by a list of files or directories that should be searched. If no files to search are specified, the current directory (.) is used.

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 ‘-’ followed by some other letters (for example ‘-print’), or is either ‘(’ or ‘!’. Any arguments after it are the rest of the expression.

If no expression is given, the expression ‘-print’ is used.

The find command exits with status zero if all files matched are processed successfully, greater than zero if errors occur.

The find program also recognises two options for administrative use:

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

The ‘-version’ option is a synonym for ‘--version