Picture of Michael Lee
:wave: Hey hey, I'm Michael Lee and this is my site about being a developer, being a dad and making side projects.

Tree command line tool

Written on December 8, 2015

I just discovered a neat little command line tool called tree. What tree does is list the content of directories in a tree-like format. This is super useful if you want to quickly share a visual representation of a project’s file structure.

To install tree on Mac OS X, you could use hombrew and run brew install tree.

Once installed you can run tree and it’ll recursively print out the file structure for the current folder you are in.

tree has a lot of options that makes it super flexible on what you want it to print out. Such as tree -L 1 --dirsfirst. What this commands does is limits the depth of the tree to 1 level and prints directories before files.

What you’ll get is something like this:

.
├── _includes
├── _layouts
├── _posts
├── _sass
├── css
├── _config.yml
├── about.md
├── feed.xml
└── index.html
Thanks for taking the time to read this article. I'd love to stay in touch and share more tips on programming and design and side projects. Sign up and I'll send you my articles straight to your email.