man find Flashcards
(6 cards)
what is the find command used for?
searchs for files in a directory hierarchy
How does find use symbolic link?
By default find use symbolic link inode information and not the inode information of what it’s linked too (aka -P option is the default). If you want find to use inode information of what the symbolic link points too you have to use the -L option at the begining of the find command.
What is a inode, a directory file, and a directory entry.
and how is stat used in this case?
- inode contains metadata about a file (aka can be a file or directory since a directory is just a file in linux)
- a directory file can contain many directory entries
- a directory entry is a data entry of (filename => inode id)
When a file is searched for using find, it will look for the file via the files inode metadata. stat can be used to view a files inode metadata. EX stat somefile.
What is the command structure/format of find?
find [-H] [-L] [-P] [-D debugopts] [-0level] [starting-points…][expressions]
what are the operations that [expressions] can contain for find?
find [-H] [-L] [-P] [-D debugopts] [-0level] [starting-points…][expressions]
- Tests
- Action
- Global options
- Positional options
- Operators
Details:
- Tests
- Tests return a true or false value, usually on the basis of some property of a file we are considering. The -empty test for example is true only when the current file is empty.
- Action
- Actions have side effects (such as printing something on the standard output) and return either true or false, usually based on whether or not they are successful. The -print action for example prints the name of the current file on the standard output.
- Global options
- Global options affect the operation of tests and actions specified on any part of the command line. Global options always return true. The -depth option for example makes find tra‐ verse the file system in a depth-first order.
- Positional options
- Positional optiona affect only tests or actions which follow them. Positional options always return true. The -regextype option for example is positional, specifying the regular expression dialect for regulat expressions occurring later on the command line.
- Operators
- Operators 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.
What does the positional operations do in the find command?
What are the positional operations that [expressions] can do in the find command?
find [-H] [-L] [-P] [-D debugopts] [-0level] [starting-points…][expressions]