I want to list only those directories which are a particular depth from current directory. Let's say depth=2

The directories listed can be:


If depth is 3



  • Does symbolic links to directories elsewhere count? – Kusalananda Oct 23 '18 at 5:21
  • @Kusalananda Yes it does – sidharth arya Oct 23 '18 at 5:50

find allows you to specify both a minimal and maximal recursion depth:

find . -mindepth 3 -maxdepth 3 -type d

Assuming that the depth is 2. You can use

find . -type d -maxdepth 2 -mindepth 2

Here type d option will list only directory.

maxdepth 2 and mindepth 2 will give all the directories and files with exact depth of 2.

Not the answer you're looking for? Browse other questions tagged or ask your own question.