Embracing the Messiness in Search of Epic Solutions

“tree” Command on Mac OS X




So, I have been drawing the ASCII file structure tree by hand lately… and that is dumb and time consuming. After digging around, I found a great way to do so.

First, if you don’t have Homebrew, install it first.

Run the following command to install the tree command:-

brew install tree

Now, you can run the following command to create a tree:-

tree [directory]

For example:

tree testMe

… generates:-

├── src
├── testMe.iml
└── web
    ├── WEB-INF
    │   ├── lib
    │   └── web.xml
    └── index.jsp



3 responses to ““tree” Command on Mac OS X”

  1. Vamsi Kurukuri Avatar
    Vamsi Kurukuri

    Is there a way to specify the depth

    1. Choon-Chern Lim Avatar

      Yes, you can specify -L option. For example, tree -L 1 will show depth of 1.

  2. […] I found a simple way to produce tree-like listings of files/folders on the mac. This is a very useful tool to get an overview of some project code. You can install it simply (following instructions I found here). […]

Leave a Reply