Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a folder tree that looks like this


I want it to show the tree up to the folder what I want. Because the folders sth, other and so on contain many other things that are useless.

I just want to see what's inside each folder named xxxx-xxxxxxxx-xxxxx.

Is there any way?

share|improve this question
up vote 5 down vote accepted

If you want to display only a list of filenames and directory names, tree command is very convenient.

This is not installed by default, you have to install this:

sudo apt-get install tree

Then, you can see the tree structure by using the below command:

tree -L 2 main/

option -L : will set the directory depth number.

Example screenshot:

enter image description here

share|improve this answer

You cannot specify recursion depth in ls, but instead you can use the following:

find -maxdepth 2 -type d -ls


share|improve this answer

Use wildcards for your search like

ls /main/*/*/

That will list with a search depth of 2. User more wildcards for deeper search.

share|improve this answer

This should do it:

find -maxdepth 2 -ls
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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