Live Chat!

Generate ASCII tree view

          0 votos

September 27th, 2006 mysurface Posted in Common, Misc, tree | Hits: 2929 |

You can use tree to list the directories and files in a tree structure. I am here to show you the example with some options specified.

Usually tree will shows files as well as directories, but this time I want to see directories only.

tree -d /usr

Wow, thats a lots and messy. Okay I want it to show only directories within 2 level

tree -d -L 2 /usr

Okay, again I can beautified it by using color (C) and better symbol (A)

tree -dCA -L 2 /usr

If I want to store the tree generated into a file?
(Make sure you turn off color and special symbol. )

tree -d -L 1 / > tree-view.txt

The command line above shows 1 level tree from / and store into tree-view.txt.

Leave a Reply