Find
traverses a directory hiearchy, and prints file names. It starts at
path,
typically but not necessarily a directory, and recursively walks all directories, printing the full path name (which always starts with
path)
of each file.
If option
-l
was given more information is printed, in a format similar to that of
ls(1).
Option
-/
prints a
/
after a path if it is a directory.
The remaining options filter paths to print and traverse. The next options can only be specified once:
- -d mindepth
- Minimum depth of file required to print the file, relative to
path.
Path
is at depth 0 (even if it is a plain file).
The first file in
path
is at depth 1.
- -D maxdepth
- Maximum depth of file to print the file, and traverse if it is a directory.
- -f or -F
- Print only files in case of
-f,
or only directories in case of
-F.
By default, both files and directories are printed. Only one of these options may be specified.
The remaining options can be specified multiple times. For each lower case option a similar upper case option exists, except for
-J
and
-T.
Files are printed if they match at least one of the patterns specified with the lower case options, or when no such patterns were specified. But only if the file does not match any of the patterns specified by the upper case options. The options and the file property they check against:
- -[uU] user
- Owner (uid) of the file.
- -[gG] group
- Group (gid) of the file.
- -[iI] name
- Case-insensitive
name
of the file.
Name
is interpreted as a file pattern, see
filepat(2)
for details.
This only checks against the name of the file itself, not against the whole path.
- -[nN] name
- Case-sensitive
name
of the file.
Name
is interpreted as a file pattern, see
filepat(2)
for details.
This only checks against the name of the file itself, not against the whole path.
- -J name
- Case-insensitive compare. Don't print, and stop walking a (sub)tree when it matches.
- -T name
- Like
-J,
but with case-sensitive compare.
- -[rR] pathregex
- Regular expression
pathregex
is matched against the full path (always starting with
path).
- -[pP] perm
- Permission bits (8r777) of the file,
perm
is interpreted as octal number.
- -[mM] mode
- Mode bits (~8r777) of the file.
Mode
must be a string with one or more of the following characters:
d
for directory,
a
for append-only,
A
for authentication file,
l
for exclusive-use file.