Tree command line tool

Written by Michael Lee 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
├── 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, side projects and working remotely. Sign up and I'll send you my articles straight to your email.

:wave: Hey hey, I'm Michael Lee! I really appreciate you taking the time to read this article.

Be sure to check out my other articles.