Ubuntu – use ls -R to show up to 2 folder depth


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?

Best Answer

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

Related Question