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” )
find /some/directory -name foo
You can limit how deep into the sub directories the linux find command searches by using the maxdepth flag. :
find /some/directory -name foo -maxdepth 5
You can tell the linux find command how deep into the sub directories to start searching as well (-mindepth flag).
find /some/directory -name foo -mindepth 3
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:
find /some/directory -name foo -mindepth 3 -maxdepth 5