zisw4a
Last Updated: February 25, 2016
·
700
· barnettjw
43ea08b4fc547e8a5da87c207bea2123

Draw Structure of Directory Hierarchy

Linux oneliner that draw's the structure of a directory Hierarchy using the magic of sed and dash of grep

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'

And then you get this:

/home/dem/apps/firefox
   |-chrome
   |---icons
   |-----default
   |-components
   |-defaults
   |---autoconfig
   |---pref
   |---profile
   |-----chrome
   |-extensions
   |---{972ce4c6-7e08-474-a285-320298ce6fd}   
   |---inspector~mozilla.org
   |-----chrome
   |-----components
   |-----defaults
   |-------preferences
   |---talkback~mozilla.org
   |-----components
   |-------talkback
   |-greprefs
   |-icons
   |-plugins
   |-res
   |---dtd
   |---entityTables
   |---fonts
   |---html
   |-searchplugins
   |-updates
   |---0

source: http://www.centerkey.com/tree/

Say Thanks
Respond

2 Responses
Add your response

4903
D42a7264714dee5006b9c99d2567a320

Isn't there a built-in analog of DOS-like tree? I always thought that's weird, sounds like a common task...

over 1 year ago ·
4916
43ea08b4fc547e8a5da87c207bea2123

There is a command tree however it's not part of a standard package, so you probably have to install it on most systems.

over 1 year ago ·