from right‐justified (which is the default) to left‐justified.
See the UNUSUAL FILENAMES section for information about how unusual characters in filenames are handled.
-prune True; if the file is a directory, do not descend into it. If -depth is given, then -prune has no effect. Because -delete implies -depth, you cannot usefully use -prune and -delete together. For example, to
skip the directory src/emacs and all files and directories under it, and print the names of the other files found, do something like this:
find . -path ./src/emacs -prune -o -print
-quit Exit immediately (with return value zero if no errors have occurred). This is different to -prune because -prune only applies to the contents of pruned directories, while -quit simply makes find stop immedi‐
ately. No child processes will be left running. Any command lines which have been built by -exec ... + or -execdir ... + are invoked before the program is exited. After -quit is executed, no more files spec‐
ified on the command line will be processed. For example, ‘find /tmp/foo /tmp/bar -print -quit‘ will print only ‘/tmp/foo‘.
One common use of -quit is to stop searching the file system once we have found what we want. For example, if we want to find just a single file we can do this:
find / ‐name needle ‐print ‐quit
OPERATORS
Listed in order of decreasing precedence:
( expr )
Force precedence. Since parentheses are special to the shell, you will normally need to quote them. Many of the examples in this manual page use backslashes for this purpose: ‘\(...\)’ instead of ‘(...)’.
! expr True if expr is false. This character will also usually need protection from interpretation by the shell.
-not expr
Same as ! expr, but not POSIX compliant.
expr1 expr2
Two expressions in a row are taken to be joined with an implied -a; expr2 is not evaluated if expr1 is false.
expr1 -a expr2
Same as expr1 expr2.
expr1 -and expr2
Same as expr1 expr2, but not POSIX compliant.
expr1 -o expr2
Or; expr2 is not evaluated if expr1 is true.
expr1 -or expr2
Same as expr1 -o expr2, but not POSIX compliant.
expr1 , expr2
List; both expr1 and expr2 are always evaluated. The value of expr1 is discarded; the value of the list is the value of expr2. The comma operator can be useful for searching for several different types of
thing, but traversing the filesystem hierarchy only once. The -fprintf action can be used to list the various matched items into several different output files.
Please note that -a when specified implicitly (for example by two tests appearing without an explicit operator between them) or explicitly has higher precedence than -o. This means that find . -name afile -o -name
bfile -print will never print afile.
UNUSUAL FILENAMES
Many of the actions of find result in the printing of data which is under the control of other users. This includes file names, sizes, modification times and so forth. File names are a potential problem since they
can contain any character except ‘\0’ and ‘/’. Unusual characters in file names can do unexpected and often undesirable things to your terminal (for example, changing the settings of your function keys on some termi‐
nals). Unusual characters are handled differently by various actions, as described below.
-print0, -fprint0
Always print the exact filename, unchanged, even if the output is going to a terminal.
-ls, -fls
Unusual characters are always escaped. White space, backslash, and double quote characters are printed using C‐style escaping (for example ‘\f’, ‘\"’). Other unusual characters are printed