search for files in a directory hierarchy
|
find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path...] [expression]
|
-depth Process each directory's contents before the directory itself. The -delete action also implies
-depth.
|
-type c
File is of type c:
b block (buffered) special
c character (unbuffered) special
d directory
p named pipe (FIFO)
f regular file
l symbolic link; this is never true if the -L option or the -follow option is in effect,
unless the symbolic link is broken. If you want to search for symbolic links when -L is in
effect, use -xtype.
s socket
D door (Solaris)
|
-name pattern
Base of file name (the path with the leading directories removed) matches shell pattern pattern.
The metacharacters (`*', `?', and `[]') match a `.' at the start of the base name (this is a
change in findutils-4.2.2; see section STANDARDS CONFORMANCE below). To ignore a directory and
the files under it, use -prune; see an example in the description of -path. Braces are not
recognised as being special, despite the fact that some shells including Bash imbue braces with a
special meaning in shell patterns. The filename matching is performed with the use of the
fnmatch(3) library function. Don't forget to enclose the pattern in quotes in order to protect
it from expansion by the shell.
|
-execdir command ;
-execdir command {} +
Like -exec, but the specified command is run from the subdirectory containing the matched file,
which is not normally the directory in which you started find. This a much more secure method for
invoking commands, as it avoids race conditions during resolution of the paths to the matched
files. As with the -exec action, the `+' form of -execdir will build a command line to process
more than one matched file, but any given invocation of command will only list files that exist in
the same subdirectory. If you use this option, you must ensure that your $PATH environment
variable does not reference `.'; otherwise, an attacker can run any commands they like by leaving
an appropriately-named file in a directory in which you will run -execdir. The same applies to
having entries in $PATH which are empty or which are not absolute directory names.
|
GNU Bourne-Again SHell
|
-c string If the -c option is present, then commands are read from string. If there are arguments after
the string, they are assigned to the positional parameters, starting with $0.
-i If the -i option is present, the shell is interactive.
-l Make bash act as if it had been invoked as a login shell (see INVOCATION below).
-r If the -r option is present, the shell becomes restricted (see RESTRICTED SHELL below).
-s If the -s option is present, or if no arguments remain after option processing, then commands
are read from the standard input. This option allows the positional parameters to be set when
invoking an interactive shell.
-D A list of all double-quoted strings preceded by $ is printed on the standard output. These are
the strings that are subject to language translation when the current locale is not C or POSIX.
This implies the -n option; no commands will be executed.
[-+]O [shopt_option]
shopt_option is one of the shell options accepted by the shopt builtin (see SHELL BUILTIN
COMMANDS below). If shopt_option is present, -O sets the value of that option; +O unsets it.
If shopt_option is not supplied, the names and values of the shell options accepted by shopt
are printed on the standard output. If the invocation option is +O, the output is displayed in
a format that may be reused as input.
-- A -- signals the end of options and disables further option processing. Any arguments after
the -- are treated as filenames and arguments. An argument of - is equivalent to --.
Bash also interprets a number of multi-character options. These options must appear on the command line
before the single-character options to be recognized.
|