Find: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 44: Line 44:


In order to access directory between an upper and lower depth limit, both  -mindepth and -maxdepth should be used.
In order to access directory between an upper and lower depth limit, both  -mindepth and -maxdepth should be used.
=-name Patterns=
A pattern for file names with specific characters on specific positions can be specified with [...]:
<pre>
find . -name *.[jw]ar
</pre>
looks for *.jar and *.war.


==Time Constraints==
==Time Constraints==

Revision as of 16:38, 1 May 2017

Internal

Usage

Target Type

find . -type <type-identifier>

where the type identifier can be:

  • f regular file
  • d directory
  • l symbolic link
  • b block special
  • c character special
  • p FIFO
  • s socket

Case Insensitive Search

find . -iname ...

Control Descend Depth

The upper and lower limit of the descend depth can be controlled with -mindepth and -maxdepth, as follows:

find . -mindepth n

Configure find to apply tests and action at levels equal or deeper than n. -mindepth 1 processes all but the command line arguments.

find . -maxdepth n

Configure find to descend at most n directory levels below the command line arguments. -maxdepth 0 limits the whole search to the command line arguments.

In order to access directory between an upper and lower depth limit, both -mindepth and -maxdepth should be used.

Time Constraints

Find all files modified less that 2 days ago

find . -mtime -2