man find Flashcards

1
Q

what is the find command used for?

A

searchs for files in a directory hierarchy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does find use symbolic link?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a inode, a directory file, and a directory entry.

and how is stat used in this case?

A
  1. inode contains metadata about a file (aka can be a file or directory since a directory is just a file in linux)
  2. a directory file can contain many directory entries
  3. 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the command structure/format of find?

A

find [-H] [-L] [-P] [-D debugopts] [-0level] [starting-points…][expressions]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what are the operations that [expressions] can contain for find?

find [-H] [-L] [-P] [-D debugopts] [-0level] [starting-points…][expressions]

A
  1. Tests
  2. Action
  3. Global options
  4. Positional options
  5. Operators

Details:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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]

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly