Linux Find Command: Searching Within a Directory

The Linux find command starts looking wherever you tell it to. This Post is about how to tell it where to start looking for the files you specify when you type out the rest of the find command line.
Specifying the directory is as simple as typing it immediately after the word find, like this:

( in this example we look for a filed named “foo” )

You can limit how deep into the sub directories the linux find command searches by using the maxdepth flag. :

You can tell the linux find command how deep into the sub directories to start searching as well (-mindepth flag).

Its no problem to specify both how deep into a sub directory to start searching with find and also how far down the directory tree you wish to search by using both flags, like this:

Leave a Reply

Your email address will not be published. Required fields are marked *