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 using an octal es‐
cape. Other printable characters (for -ls and -fls these are the characters between octal 041 and 0176) are printed as‐is.
-printf, -fprintf
If the output is not going to a terminal, it is printed as‐is. Otherwise, the result depends on which directive is in use. The directives %D, %F, %g, %G, %H, %Y, and %y expand to values which are not under
control of files’ owners, and so are printed as‐is. The directives %a, %b, %c, %d, %i, %k, %m, %M, %n, %s, %t, %u and %U have values which are under the control of files’ owners but which cannot be used to
send arbitrary data to the terminal, and so these are printed as‐is. The directives %f, %h, %l, %p and %P are quoted. This quoting is performed in the same way as for GNU ls. This is not the same quoting
mechanism as the one used for -ls and -fls. If you are able to decide what format to use for the output of find then it is normally better to use ‘\0’ as a terminator than to use newline, as file names can
contain white space and newline characters. The setting of the LC_CTYPE environment variable is used to determine which characters need to be quoted.
-print, -fprint
Quoting is handled in the same way as for -printf and -fprintf. If you are using find in a script or in a situation where the matched files might have arbitrary names, you should consider using -print0 instead
of -print.
The -ok and -okdir actions print the current filename as‐is. This may change in a future release.
STANDARDS CONFORMANCE
For closest compliance to the POSIX standard, you should set the POSIXLY_CORRECT environment variable. The following options are specified in the POSIX standard (IEEE Std 1003.1‐2008, 2016 Edition):
-H This option is supported.
-L This option is supported.
-name This option is supported, but POSIX conformance depends on the POSIX conformance of the system’s fnmatch(3) library function. As of findutils‐4.2.2, shell metacharacters (‘*’, ‘?’ or ‘[]’ for example) match a
leading ‘.’, because IEEE PASC interpretation 126 requires this. This is a change from previous versions of findutils.
-type Supported. POSIX specifies ‘b’, ‘c’, ‘d’, ‘l’, ‘p’, ‘f’ and ‘s’. GNU find also supports ‘D’, representing a Door, where the OS provides these. Furthermore, GNU find allows multiple types to be specified at
once in a comma‐separated list.
-ok Supported. Interpretation of the response is according to the ‘yes’ and ‘no’ patterns selected by setting the LC_MESSAGES environment variable. When the POSIXLY_CORRECT environment variable is set, these pat‐
terns are taken system’s definition of a positive (yes) or negative (no) response. See the system’s documentation for nl_langinfo(3), in particular YESEXPR and NOEXPR. When POSIXLY_CORRECT