18-11-2011

Unix/Linux Find directory by name using the find command

To find a directory in a subdirectory of the current directory by specifying only it's name you can use the find command with the following paremeters.

find . -maxdepth 4 -type d -name somedirectoryname -print
 

The maxdepth parameter signifies the maximum levels of recursion into subdirectories.

The type parameter defines that we are looking for directories.

name specifies directoryname

You need the -print option otherwise it won't show you the result.

Keywords: find

Comments:

Your comment:

»

 

[x]