Linux "find" Command Line Options and Examples
search for files in a directory hierarchy

This manual page documents the GNU version of find.


Usage:

find [-H] [-L] [-P] [-D debugopts] [-Olevel] [starting-point...] [expression]






Command Line Options:

-ilname
predicates always to return false.
find -ilname ...
-follow
any symbolic links appearing after -follow on the command line will be dereferenced and those before it will not).
find -follow ...
-D
Print diagnostic information; this can be helpful to diagnose problems with why find is not doing what you want. The list ofdebug options should be comma separated. Compatibility of the debug options is not guaranteed between releases of findutils.For a complete list of valid debug options, see the output of find -D help. Valid debug options includeexec Show diagnostic information relating to -exec, -execdir, -ok and -okdirhelp Explain the debugging options.opt Prints diagnostic information relating to the optimisation of the expression tree; see the -O option.rates Prints a summary indicating how often each predicate succeeded or failed.search Navigate the directory tree verbosely.stat Print messages as files are examined with the stat and lstat system calls. The find program tries to minimise suchcalls.tree Show the expression tree in its original and optimised form.
find -D ...
-Olevel
Enables query optimisation. The find program reorders tests to speed up execution while preserving the overall effect; thatis, predicates with side effects are not reordered relative to each other. The optimisations performed at each optimisationlevel are as follows.0 Equivalent to optimisation level 1.1 This is the default optimisation level and corresponds to the traditional behaviour. Expressions are reordered so thattests based only on the names of files (for example -name and -regex) are performed first.2 Any -type or -xtype tests are performed after any tests based only on the names of files, but before any tests thatrequire information from the inode. On many modern versions of Unix, file types are returned by readdir() and so thesepredicates are faster to evaluate than predicates which need to stat the file first. If you use the -fstype FOO predi‐cate and specify a filesystem type FOO which is not known (that is, present in `/etc/mtab') at the time find starts,that predicate is equivalent to -false.3 At this optimisation level, the full cost-based query optimiser is enabled. The order of tests is modified so thatcheap (i.e. fast) tests are performed first and more expensive ones are performed later, if necessary. Within eachcost band, predicates are evaluated earlier or later according to whether they are likely to succeed or not. For -o,predicates which are likely to succeed are evaluated earlier, and for -a, predicates which are likely to fail are eval‐uated earlier.The cost-based optimiser has a fixed idea of how likely any given test is to succeed. In some cases the probability takesaccount of the specific nature of the test (for example, -type f is assumed to be more likely to succeed than -type c). Thecost-based optimiser is currently being evaluated. If it does not actually improve the performance of find, it will beremoved again. Conversely, optimisations that prove to be reliable, robust and effective may be enabled at lower optimisationlevels over time. However, the default behaviour (i.e. optimisation level 1) will not be changed in the 4.3.x release series.The findutils test suite runs all the tests on find at each optimisation level and ensures that the result is the same.EXPRESSIONThe part of the command line after the list of starting points is the expression. This is a kind of query specification describinghow we match files and what we do with the files that were matched. An expression is composed of a sequence of things:Tests Tests return a true or false value, usually on the basis of some property of a file we are considering. The -empty test forexample is true only when the current file is empty.ActionsActions have side effects (such as printing something on the standard output) and return either true or false, usually basedon whether or not they are successful. The -print action for example prints the name of the current file on the standard out‐put.Global optionsGlobal options affect the operation of tests and actions specified on any part of the command line. Global options alwaysreturn true. The -depth option for example makes find traverse the file system in a depth-first order.Positional optionsPositional options affect only tests or actions which follow them. Positional options always return true. The -regextypeoption for example is positional, specifying the regular expression dialect for regular expressions occurring later on thecommand line.OperatorsOperators join together the other items within the expression. They include for example -o (meaning logical OR) and -a (mean‐ing logical AND). Where an operator is missing, -a is assumed.If the whole expression contains no actions other than -prune or -print, -print is performed on all files for which the whole expres‐sion is true.The -delete action also acts like an option (since it implies -depth).POSITIONAL OPTIONSPositional options always return true. They affect only tests occurring later on the command line.
find -Olevel ...
-daystart
Measure times (for -amin, -atime, -cmin, -ctime, -mmin, and -mtime) from the beginning of today rather than from 24 hours ago.This option only affects tests which appear later on the command line.
find -daystart ...
-regextype
Changes the regular expression syntax understood by -regex and -iregex tests which occur later on the command line. To seewhich regular expression types are known, use -regextype help. The Texinfo documentation (see SEE ALSO) explains the meaningof and differences between the various types of regular expression.
find -regextype ...
-warn
Turn warning messages on or off. These warnings apply only to the command line usage, not to any conditions that find mightencounter when it searches directories. The default behaviour corresponds to -warn if standard input is a tty, and to -nowarnotherwise. If a warning message relating to command-line usage is produced, the exit status of find is not affected. If thePOSIXLY_CORRECT environment variable is set, and -warn is also used, it is not specified which, if any, warnings will beactive.GLOBAL OPTIONSGlobal options always return true. Global options take effect even for tests which occur earlier on the command line. To preventconfusion, global options should specified on the command-line after the list of start points, just before the first test, positionaloption or action. If you specify a global option in some other place, find will issue a warning message explaining that this can beconfusing.The global options occur after the list of start points, and so are not the same kind of option as -L, for example.
find -warn ...
-d
for compatibility with FreeBSD NetBSD MacOS X and OpenBSD.
find -d ...
-depth
Process each directory's contents before the directory itself. The -delete action also implies -depth.
find -depth ...
-help
Print a summary of the command-line usage of find and exit.
find -help ...
-ignore_readdir_race
Normally, find will emit an error message when it fails to stat a file. If you give this option and a file is deleted betweenthe time find reads the name of the file from the directory and the time it tries to stat the file, no error message will beissued. This also applies to files or directories whose names are given on the command line. This option takes effect atthe time the command line is read, which means that you cannot search one part of the filesystem with this option on and partof it with this option off (if you need to do that, you will need to issue two find commands instead, one with the option andone without it).
find -ignore_readdir_race ...
-maxdepth
Descend at most levels (a non-negative integer) levels of directories below the starting-points. -maxdepth 0means only apply the tests and actions to the starting-points themselves.
find -maxdepth ...
-mindepth
Do not apply any tests or actions at levels less than levels (a non-negative integer). -mindepth 1 means process all filesexcept the starting-points.
find -mindepth ...
-noignore_readdir_race
Turns off the effect of -ignore_readdir_race.
find -noignore_readdir_race ...
-noleaf
Do not optimize by assuming that directories contain 2 fewer subdirectories than their hard link count. This option is neededwhen searching filesystems that do not follow the Unix directory-link convention, such as CD-ROM or MS-DOS filesystems or AFSvolume mount points. Each directory on a normal Unix filesystem has at least 2 hard links: its name and its `.' entry.Additionally, its subdirectories (if any) each have a `..' entry linked to that directory. When find is examining a direc‐tory, after it has statted 2 fewer subdirectories than the directory's link count, it knows that the rest of the entries inthe directory are non-directories (`leaf' files in the directory tree). If only the files' names need to be examined, thereis no need to stat them; this gives a significant increase in search speed.
find -noleaf ...
-version
Print the find version number and exit.
find -version ...
-xdev
TESTSSome tests, for example -newerXY and -samefile, allow comparison between the file currently being examined and some reference filespecified on the command line. When these tests are used, the interpretation of the reference file is determined by the options -H,
find -xdev ...
-n
n for exactly n.
find -n ...
-amin
File was last accessed n minutes ago.
find -amin ...
-anewer
File was last accessed more recently than file was modified. If file is a symbolic link and the -H option or the -L option isin effect, the access time of the file it points to is always used.
find -anewer ...
-atime
File was last accessed n*24 hours ago. When find figures out how many 24-hour periods ago the file was last accessed, anyfractional part is ignored, so to match -atime +1, a file has to have been accessed at least two days ago.
find -atime ...
-cmin
File's status was last changed n minutes ago.
find -cmin ...
-cnewer
File's status was last changed more recently than file was modified. If file is a symbolic link and the -H option or the -Loption is in effect, the status-change time of the file it points to is always used.
find -cnewer ...
-ctime
File's status was last changed n*24 hours ago. See the comments for -atime to understand how rounding affects the interpreta‐tion of file status change times.
find -ctime ...
-empty
File is empty and is either a regular file or a directory.
find -empty ...
-executable
Matches files which are executable and directories which are searchable (in a file name resolution sense). This takes intoaccount access control lists and other permissions artefacts which the -perm test ignores. This test makes use of theaccess(2) system call, and so can be fooled by NFS servers which do UID mapping (or root-squashing), since many systems imple‐ment access(2) in the client's kernel and so cannot make use of the UID mapping information held on the server. Because thistest is based only on the result of the access(2) system call, there is no guarantee that a file for which this test succeedscan actually be executed.
find -executable ...
-fstype
File is on a filesystem of type type. The valid filesystem types vary among different versions of Unix; an incomplete list offilesystem types that are accepted on some version of Unix or another is: ufs, 4.2, 4.3, nfs, tmp, mfs, S51K, S52K. You canuse -printf with the %F directive to see the types of your filesystems.
find -fstype ...
-gid
n File's numeric group ID is n.
find -gid ...
-group
File belongs to group gname (numeric group ID allowed).
find -group ...
-iname
Like -name, but the match is case insensitive. For example, the patterns `fo*' and `F??' match the file names `Foo', `FOO',`foo', `fOo', etc. The pattern `*foo*` will also match a file called '.foobar'.
find -iname ...
-inum
File has inode number n. It is normally easier to use the -samefile test instead.
find -inum ...
-ipath
Like -path. but the match is case insensitive.
find -ipath ...
-iregex
Like -regex, but the match is case insensitive.
find -iregex ...
-iwholename
See -ipath. This alternative is less portable than -ipath.
find -iwholename ...
-links
File has n hard links.
find -links ...
-lname
File is a symbolic link whose contents match shell pattern pattern. The metacharacters do not treat `/' or `.' specially. Ifthe -L option or the -follow option is in effect, this test returns false unless the symbolic link is broken.
find -lname ...
-mmin
File's data was last modified n minutes ago.
find -mmin ...
-mtime
File's data was last modified n*24 hours ago. See the comments for -atime to understand how rounding affects the interpreta‐tion of file modification times.
find -mtime ...
-name
Base of file name (the path with the leading directories removed) matches shell pattern pattern. Because the leading directo‐ries are removed, the file names considered for a match with -name will never include a slash, so `-name a/b' will never matchanything (you probably need to use -path instead). A warning is issued if you try to do this, unless the environment variablePOSIXLY_CORRECT is set. The metacharacters (`*', `?', and `[]') match a `.' at the start of the base name (this is a changein findutils-4.2.2; see section STANDARDS CONFORMANCE below). To ignore a directory and the files under it, use -prune; seean example in the description of -path. Braces are not recognised as being special, despite the fact that some shells includ‐ing Bash imbue braces with a special meaning in shell patterns. The filename matching is performed with the use of thefnmatch(3) library function. Don't forget to enclose the pattern in quotes in order to protect it from expansion by theshell.
find -name ...
-newer
File was modified more recently than file. If file is a symbolic link and the -H option or the -L option is in effect, themodification time of the file it points to is always used.
find -newer ...
-newerXY
Succeeds if timestamp X of the file being considered is newer than timestamp Y of the file reference. The letters X and Ycan be any of the following letters:a The access time of the file referenceB The birth time of the file referencec The inode status change time of referencem The modification time of the file referencet reference is interpreted directly as a timeSome combinations are invalid; for example, it is invalid for X to be t. Some combinations are not implemented on all sys‐tems; for example B is not supported on all systems. If an invalid or unsupported combination of XY is specified, a fatalerror results. Time specifications are interpreted as for the argument to the -d option of GNU date. If you try to use thebirth time of a reference file, and the birth time cannot be determined, a fatal error message results. If you specify a testwhich refers to the birth time of files being examined, this test will fail for any files where the birth time is unknown.
find -newerXY ...
-nogroup
No group corresponds to file's numeric group ID.
find -nogroup ...
-nouser
No user corresponds to file's numeric user ID.
find -nouser ...
-path
File name matches shell pattern pattern. The metacharacters do not treat `/' or `.' specially; so, for example,find . -path "./sr*sc"will print an entry for a directory called `./src/misc' (if one exists). To ignore a whole directory tree, use -prune ratherthan checking every file in the tree. 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 -printNote that the pattern match test applies to the whole file name, starting from one of the start points named on the commandline. It would only make sense to use an absolute path name here if the relevant start point is also an absolute path. Thismeans that this command will never match anything:find bar -path /foo/bar/myfile -printFind compares the -path argument with the concatenation of a directory name and the base name of the file it's examining.Since the concatenation will never end with a slash, -path arguments ending in a slash will match nothing (except perhaps astart point specified on the command line). The predicate -path is also supported by HP-UX find and is part of the POSIX 2008standard.
find -path ...
-perm
File's permission bits are exactly mode (octal or symbolic). Since an exact match is required, if you want to use this formfor symbolic modes, you may have to specify a rather complex mode string. For example `-perm g=w' will only match files whichhave mode 0020 (that is, ones for which group write permission is the only permission set). It is more likely that you willwant to use the `/' or `-' forms, for example `-perm -g=w', which matches any file with group write permission. See the EXAM‐PLES section for some illustrative examples.
find -perm ...
-readable
Matches files which are readable. This takes into account access control lists and other permissions artefacts which the
find -readable ...
-regex
File name matches regular expression pattern. This is a match on the whole path, not a search. For example, to match a filenamed `./fubar3', you can use the regular expression `.*bar.' or `.*b.*3', but not `f.*r3'. The regular expressions under‐stood by find are by default Emacs Regular Expressions, but this can be changed with the -regextype option.
find -regex ...
-samefile
File refers to the same inode as name. When -L is in effect, this can include symbolic links.
find -samefile ...
-size
File uses n units of space, rounding up. The following suffixes can be used:`b' for 512-byte blocks (this is the default if no suffix is used)`c' for bytes`w' for two-byte words`k' for Kibibytes (KiB, units of 1024 bytes)`M' for Mebibytes (MiB, units of 1024 * 1024 = 1048576 bytes)`G' for Gibibytes (GiB, units of 1024 * 1024 * 1024 = 1073741824 bytes)The size does not count indirect blocks, but it does count blocks in sparse files that are not actually allocated. Bear inmind that the `%k' and `%b' format specifiers of -printf handle sparse files differently. The `b' suffix always denotes512-byte blocks and never 1024-byte blocks, which is different to the behaviour of -ls.The + and - prefixes signify greater than and less than, as usual; i.e., an exact size of n units does not match. Bear inmind that the size is rounded up to the next unit. Therefore -size -1M is not equivalent to -size -1048576c. The former onlymatches empty files, the latter matches files from 0 to 1,048,575 bytes.
find -size ...
-type
File is of type c:b block (buffered) specialc character (unbuffered) speciald directoryp named pipe (FIFO)f regular filel symbolic link; this is never true if the -L option or the -follow option is in effect, unless the symbolic link is bro‐ken. If you want to search for symbolic links when -L is in effect, use -xtype.s socketD door (Solaris)To search for more than one type at once, you can supply the combined list of type letters separated by a comma `,' (GNUextension).
find -type ...
-uid
n File's numeric user ID is n.
find -uid ...
-used
File was last accessed n days after its status was last changed.
find -used ...
-user
File is owned by user uname (numeric user ID allowed).
find -user ...
-wholename
See -path. This alternative is less portable than -path.
find -wholename ...
-writable
Matches files which are writable. This takes into account access control lists and other permissions artefacts which the
find -writable ...
-xtype
The same as -type unless the file is a symbolic link. For symbolic links: if the -H or -P option was specified, true if thefile is a link to a file of type c; if the -L option has been given, true if c is `l'. In other words, for symbolic links,
find -xtype ...
-context
(SELinux only) Security context of the file matches glob pattern.ACTIONS
find -context ...
-delete
Delete files; true if removal succeeded. If the removal failed, an error message is issued. If -delete fails, find's exitstatus will be nonzero (when it eventually exits). Use of -delete automatically turns on the `-depth' option.Warnings: Don't forget that the find command line is evaluated as an expression, so putting -delete first will make find tryto delete everything below the starting points you specified. When testing a find command line that you later intend to usewith -delete, you should explicitly specify -depth in order to avoid later surprises. Because -delete implies -depth, youcannot usefully use -prune and -delete together.
find -delete ...
-exec
Execute command; true if 0 status is returned. All following arguments to find are taken to be arguments to the command untilan argument consisting of `;' is encountered. The string `{}' is replaced by the current file name being processed everywhereit occurs in the arguments to the command, not just in arguments where it is alone, as in some versions of find. Both ofthese constructions might need to be escaped (with a `\') or quoted to protect them from expansion by the shell. See theEXAMPLES section for examples of the use of the -exec option. The specified command is run once for each matched file. Thecommand is executed in the starting directory. There are unavoidable security problems surrounding use of the -exec action;you should use the -execdir option instead.
find -exec ...
-execdir
Like -exec, but the specified command is run from the subdirectory containing the matched file, which is not normally thedirectory in which you started find. As with -exec, the {} should be quoted if find is being invoked from a shell. This amuch more secure method for invoking commands, as it avoids race conditions during resolution of the paths to the matchedfiles. 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, youmust ensure that your $PATH environment variable does not reference `.'; otherwise, an attacker can run any commands they likeby 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. If any invocation returns a non-zero value as exit status,then find returns a non-zero exit status. If find encounters an error, this can sometimes cause an immediate exit, so somepending commands may not be run at all. The result of the action depends on whether the + or the ; variant is being used;
find -execdir ...
-fls
True; like -ls but write to file like -fprint. The output file is always created, even if the predicate is never matched.See the UNUSUAL FILENAMES section for information about how unusual characters in filenames are handled.
find -fls ...
-fprint
True; print the full file name into file file. If file does not exist when find is run, it is created; if it does exist, itis truncated. The file names `/dev/stdout' and `/dev/stderr' are handled specially; they refer to the standard output andstandard error output, respectively. The output file is always created, even if the predicate is never matched. See theUNUSUAL FILENAMES section for information about how unusual characters in filenames are handled.
find -fprint ...
-fprint0
True; like -print0 but write to file like -fprint. The output file is always created, even if the predicate is never matched.See the UNUSUAL FILENAMES section for information about how unusual characters in filenames are handled.
find -fprint0 ...
-fprintf
True; like -printf but write to file like -fprint. The output file is always created, even if the predicate is never matched.See the UNUSUAL FILENAMES section for information about how unusual characters in filenames are handled.
find -fprintf ...
-ok
Like -exec but ask the user first. If the user agrees, run the command. Otherwise just return false. If the command is run,its standard input is redirected from /dev/null.The response to the prompt is matched against a pair of regular expressions to determine if it is an affirmative or negativeresponse. This regular expression is obtained from the system if the `POSIXLY_CORRECT' environment variable is set, or other‐wise from find's message translations. If the system has no suitable definition, find's own definition will be used. Ineither case, the interpretation of the regular expression itself will be affected by the environment variables 'LC_CTYPE'(character classes) and 'LC_COLLATE' (character ranges and equivalence classes).
find -ok ...
-okdir
Like -execdir but ask the user first in the same way as for -ok. If the user does not agree, just return false. If the com‐mand is run, its standard input is redirected from /dev/null.
find -okdir ...
-print0
True; print the full file name on the standard output, followed by a null character (instead of the newline character that
find -print0 ...
-printf
True; print format on the standard output, interpreting `\' escapes and `%' directives. Field widths and precisions can bespecified as with the `printf' C function. Please note that many of the fields are printed as %s rather than %d, and this maymean that flags don't work as you might expect. This also means that the `-' flag does work (it forces fields to be left-aligned). Unlike -print, -printf does not add a newline at the end of the string. The escapes and directives are:\a Alarm bell.\b Backspace.\c Stop printing from this format immediately and flush the output.\f Form feed.\n Newline.\r Carriage return.\t Horizontal tab.\v Vertical tab.\0 ASCII NUL.\\ A literal backslash (`\').\NNN The character whose ASCII code is NNN (octal).A `\' character followed by any other character is treated as an ordinary character, so they both are printed.%% A literal percent sign.%a File's last access time in the format returned by the C `ctime' function.%Ak File's last access time in the format specified by k, which is either `@' or a directive for the C `strftime' function.The possible values for k are listed below; some of them might not be available on all systems, due to differences in`strftime' between systems.@ seconds since Jan. 1, 1970, 00:00 GMT, with fractional part.Time fields:H hour (00..23)I hour (01..12)k hour ( 0..23)l hour ( 1..12)M minute (00..59)p locale's AM or PMr time, 12-hour (hh:mm:ss [AP]M)S Second (00.00 .. 61.00). There is a fractional part.T time, 24-hour (hh:mm:ss.xxxxxxxxxx)+ Date and time, separated by `+', for example `2004-04-28+22:22:05.0'. This is a GNU extension. The time isgiven in the current timezone (which may be affected by setting the TZ environment variable). The seconds fieldincludes a fractional part.X locale's time representation (H:M:S). The seconds field includes a fractional part.Z time zone (e.g., EDT), or nothing if no time zone is determinableDate fields:a locale's abbreviated weekday name (Sun..Sat)A locale's full weekday name, variable length (Sunday..Saturday)b locale's abbreviated month name (Jan..Dec)B locale's full month name, variable length (January..December)c locale's date and time (Sat Nov 04 12:02:33 EST 1989). The format is the same as for ctime(3) and so to pre‐serve compatibility with that format, there is no fractional part in the seconds field.d day of month (01..31)D date (mm/dd/yy)h same as bj day of year (001..366)m month (01..12)U week number of year with Sunday as first day of week (00..53)w day of week (0..6)W week number of year with Monday as first day of week (00..53)x locale's date representation (mm/dd/yy)y last two digits of year (00..99)Y year (1970...)%b The amount of disk space used for this file in 512-byte blocks. Since disk space is allocated in multiples of thefilesystem block size this is usually greater than %s/512, but it can also be smaller if the file is a sparse file.%c File's last status change time in the format returned by the C `ctime' function.%Ck File's last status change time in the format specified by k, which is the same as for %A.%d File's depth in the directory tree; 0 means the file is a starting-point.%D The device number on which the file exists (the st_dev field of struct stat), in decimal.%f File's name with any leading directories removed (only the last element).%F Type of the filesystem the file is on; this value can be used for -fstype.%g File's group name, or numeric group ID if the group has no name.%G File's numeric group ID.%h Leading directories of file's name (all but the last element). If the file name contains no slashes (since it is inthe current directory) the %h specifier expands to `.'.%H Starting-point under which file was found.%i File's inode number (in decimal).%k The amount of disk space used for this file in 1K blocks. Since disk space is allocated in multiples of the filesystemblock size this is usually greater than %s/1024, but it can also be smaller if the file is a sparse file.%l Object of symbolic link (empty string if file is not a symbolic link).%m File's permission bits (in octal). This option uses the `traditional' numbers which most Unix implementations use, butif your particular implementation uses an unusual ordering of octal permissions bits, you will see a difference betweenthe actual value of the file's mode and the output of %m. Normally you will want to have a leading zero on this num‐ber, and to do this, you should use the # flag (as in, for example, `%#m').%M File's permissions (in symbolic form, as for ls). This directive is supported in findutils 4.2.5 and later.%n Number of hard links to file.%p File's name.%P File's name with the name of the starting-point under which it was found removed.%s File's size in bytes.%S File's sparseness. This is calculated as (BLOCKSIZE*st_blocks / st_size). The exact value you will get for an ordi‐nary file of a certain length is system-dependent. However, normally sparse files will have values less than 1.0, andfiles which use indirect blocks may have a value which is greater than 1.0. The value used for BLOCKSIZE is system-dependent, but is usually 512 bytes. If the file size is zero, the value printed is undefined. On systems which lacksupport for st_blocks, a file's sparseness is assumed to be 1.0.%t File's last modification time in the format returned by the C `ctime' function.%Tk File's last modification time in the format specified by k, which is the same as for %A.%u File's user name, or numeric user ID if the user has no name.%U File's numeric user ID.%y File's type (like in ls -l), U=unknown type (shouldn't happen)%Y File's type (like %y), plus follow symlinks: L=loop, N=nonexistent%Z (SELinux only) file's security context.%{ %[ %(Reserved for future use.A `%' character followed by any other character is discarded, but the other character is printed (don't rely on this, as fur‐ther format characters may be introduced). A `%' at the end of the format argument causes undefined behaviour since there isno following character. In some locales, it may hide your door keys, while in others it may remove the final page from thenovel you are reading.The %m and %d directives support the # , 0 and + flags, but the other directives do not, even if they print numbers. Numericdirectives that do not support these flags include G, U, b, D, k and n. The `-' format flag is supported and changes thealignment of a field 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.
find -printf ...
-prune
True; if the file is a directory, do not descend into it. If -depth is given, false; no effect. Because -delete implies
find -prune ...
-not
Same as ! expr, but not POSIX compliant.expr1 expr2Two expressions in a row are taken to be joined with an implied -a; expr2 is not evaluated if expr1 is false.expr1 -a expr2Same as expr1 expr2.expr1 -and expr2Same as expr1 expr2, but not POSIX compliant.expr1 -o expr2Or; expr2 is not evaluated if expr1 is true.expr1 -or expr2Same as expr1 -o expr2, but not POSIX compliant.expr1 , expr2List; both expr1 and expr2 are always evaluated. The value of expr1 is discarded; the value of the list is the value ofexpr2. The comma operator can be useful for searching for several different types of thing, but traversing the filesystemhierarchy 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) orexplicitly has higher precedence than -o. This means that find . -name afile -o -name bfile -print will never print afile.UNUSUAL FILENAMESMany 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 settingsof your function keys on some terminals). Unusual characters are handled differently by various actions, as described below.
find -not ...
-ls
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 escape. Other printable characters (for -lsand -fls these are the characters between octal 041 and 0176) are printed as-is.
find -ls ...
-print
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 thematched 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 CONFORMANCEFor closest compliance to the POSIX standard, you should set the POSIXLY_CORRECT environment variable. The following options arespecified in the POSIX standard (IEEE Std 1003.1-2008, 2016 Edition):
find -print ...
-H
This option is supported.
find -H ...
-L
This option is supported.
find -L ...