Title: Theory / Unimportant / CS / command line / file / find
Tags: computer_to_instruction fromCommand fromCommandLine hasNotNewEffectReturnsMeaning some_instruction
On every note of this deck, unless a note says otherwise:
Page: man
Prefix: find

Fla: -ignore_readdir_race
Effect: If a file is deleted between the time find reads the name of the file from the directory and the time it tries to stat the file, no error message will be issued.
This also applies to files or directories whose names are given on the command line.
Extra: Normally, find will emit an error message when it fails to stat a file.
This option takes effect at the time the command line is read, which means that you cannot search one part of the filesystem with this option on and part of it with this option off (if you need to do that, you will need to issue two find commands instead, one with the option and one without it).

Fla: -mount
Effect: Don't descend directories on other filesystems. An alternate name for -xdev, for compatibility with some other versions of find.

Fla: -xautofs
Effect: Don't descend directories on autofs filesystems.

Fla: -xdev
Effect: Don't descend directories on other filesystems.

Instruction: find
Page: man
Effect: search for files in a directory hierarchy

Fla: -P
Effect: Never follow symbolic links.
Extra: This is the default behaviour. When find examines or prints information a file, and the file is a symbolic link, the information used shall be taken from the properties of the symbolic link itself.

Fla: -L
Effect: Follow symbolic links.
Extra: When find examines or prints information about files, the information used shall be taken from the properties of the file to which the link points, not from the link itself (unless it is a broken symbolic link or find is unable to examine the file to which the link points). Use of this option implies -noleaf. If you later use the -P option, -noleaf will still be in effect. If this option is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.
When the this option option is in effect, the -type predicate will always match against the type of the file that a symbolic link points to rather than the link itself (unless the symbolic link is broken). Using this option causes the -lname and -ilname predicates always to return false.

Fla: -H
Effect: Do not follow symbolic links, except while processing the command line arguments. When find examines or prints information about files, the information used shall be taken from the properties of the symbolic link itself. The only exception to this behaviour is when a file specified on the command line is a symbolic link, and the link can be resolved. For that situation, the information used is taken from whatever the link points to (that is, the link is followed). The information about the link itself is used as a fallback if the file pointed to by the symbolic link cannot be examined. If this option is in effect and one of the paths specified on the command line is a symbolic link to a directory, the contents of that directory will be examined (though of course -maxdepth 0 would prevent this).

Fla: -D
Effect: Print diagnostic information
Extra: This can be helpful to diagnose problems with why find is not doing what you want. The list of debug options should be comma separated. Compatibility of the debug options is not guaranteed between releases of findutils.

Instruction: help
Page: man
Effect: Explain the debugging options
Context: find -D

Instruction: tree
Page: man
Effect: Show the expression tree in its original and optimised form
Context: find -D

Instruction: stat
Page: man
Effect: Print messages as files are examined with the stat and lstat system calls. The find program tries to minimise such calls.
Context: find -D

Instruction: opt
Page: man
Effect: Prints diagnostic information relating to the optimisation of the expression tree; see the -O option.
Context: find -D

Instruction: rates
Page: man
Effect: Prints a summary indicating how often each predicate succeeded or failed.
Context: find -D

Fla: -Olevel
Effect: Enables query optimisation. The find program reorders tests to speed up execution while preserving the overall effect; that is, predicates with side effects are not reordered relative to each other

Fla: -daystart
Effect: 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.

Fla: -depth
Effect: Process each directory's contents before the directory itself. The -delete action also implies this command

Fla: -help
Effect: Print a summary of the command-line usage of find and exit.

Fla: -maxdepth levels
Effect: Descend at most levels (a non-negative integer) levels of directories below the command line arguments. 0 means only apply the tests and actions to the command line arguments.

Fla: -mindepth levels
Effect: Do not apply any tests or actions at levels less than levels (a non-negative integer).

Fla: -noignore_readdir_race
Effect: Turns off the effect of -ignore_readdir_race.

Fla: -noleaf
Effect: Do not optimize by assuming that directories contain 2 fewer subdirectories than their hard link count.
Extra: This option is needed when searching filesystems that do not follow the Unix directory-link convention, such as CD-ROM or MS-DOS filesystems or AFS volume 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 directory, after it has statted 2 fewer subdirectories than the directory's link count, it knows that the rest of the entries in the directory are non-directories ('leaf' files in the directory tree). If only the files' names need to be examined, there is no need to stat them; this gives a significant increase in search speed.

Fla: -regextype type
Effect: Changes the regular expression syntax understood by -regex and -iregex tests which occur later on the command line. Currently-implemented types are emacs (this is the default), posix-awk, posix-basic, posix-egrep and posix-extended.

Fla: -version --version
Effect: Print the find version number and exit.

Fla: -warn
Effect: Turn warning messages on.
Extra: These warnings apply only to the command line usage, not to any conditions that find might encounter when it searches directories. The default behaviour corresponds to -warn if standard input is a tty, and to -nowarn otherwise.

Fla: -nowarn
Effect: Turn warning messages off.
Extra: These warnings apply only to the command line usage, not to any conditions that find might encounter when it searches directories. The default behaviour corresponds to -warn if standard input is a tty, and to -nowarn otherwise.