Is there a simple way in Linux so that, when listing the files and directories, it will show me the directories organized in a tree structure?
For example:
Dir1
--> file1
--> file2
--> Dir2
--> file2.1
Dir2
--> file3
From already thank you very much.
To see the directory structure in the form of a tree you have the utility
tree
, which is not usually installed by default in most distributions.Its installation from repositories depends on the base distribution used. For ubuntu/debian:
The most useful commands are usually:
Both options can be combined. You can see a more complete list of its functions in the online man page or by using said command:
On MAC OS X you can use this tool through Homebrew .
Install Homebrew:
Install tree:
With
find
you can also get the desired information:And you can format the output to view the information in tree mode with
sed
:Font
If it is more about the information than the visual format, without installing packages it
ls -R
allows you to list contents recursively (-R).