Ever been working your way down directories with alternating ls and cd? Not knowing by heart what the whole directory structure looks like can be a pain. But there is a way out with the tree command!

This post is part of a series on command line tools. The goal is to get you started with this command if you recognise yourself in the situation above.

Installation

For mac use homebrew:

brew install tree

Command

There is not much to it. Here are the command I use the most. For the whole tree structure say this:

full tree command output - TREE COMMAND

But sometimes the output is overwhelming and you only want to know a few levels down.

tree command output with 2 levels - TREE COMMAND

I hope the tree command will save you some pain in navigating through your directories. Happy treeing!