commands may not be
run at all. For this reason -exec my‐command ... {} + -quit may not result in my‐command actually being run. This variant of -exec always returns true.
-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. As with -exec, the {} should be quoted if find is
being invoked from a shell. 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. If any invocation with the ‘+’ form returns a non‐zero value as exit status, then find returns a non‐zero exit sta‐
tus. If find encounters an error, this can sometimes cause an immediate exit, so some pending commands may not be run at all. The result of the action depends on whether the + or the ; variant is being used;
-execdir command {} + always returns true, while -execdir command {} ; returns true only if command returns 0.
-fls file
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.
-fprint file
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, it is truncated. The file names /dev/stdout and /dev/stderr are handled specially; they
refer to the standard output and standard error output, respectively. The output file is always created, even if the predicate is never matched. See the UNUSUAL FILENAMES section for information about how un‐
usual characters in filenames are handled.
-fprint0 file
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.
-fprintf file format
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.
-ls True; list current file in ls -dils format on standard output. The block counts are of 1 KB blocks, unless the environment variable POSIXLY_CORRECT is set, in which case 512‐byte blocks are used. See the UN‐
USUAL FILENAMES section for information about how unusual characters in filenames are handled.
-ok command ;
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. This action may not be specified
together with the -files0-from option.
The response to the prompt is matched against a pair of regular expressions to determine if it is an affirmative or negative response. This regular expression is obtained from the system if the POSIXLY_CORRECT
environment variable is