Skip to content

tree

The original recursive directory lister — still the fastest way to paste a project layout into a document.

Homebrew formula

What it does

tree walks a directory and prints it as an ASCII tree. Useful flags:

tree -L 2                 # depth limit
tree -a -I 'node_modules|.git'   # show hidden, ignore patterns
tree -d                   # directories only
tree -H . -o index.html   # HTML output

Notes

Worth keeping even with lsd --tree available: tree’s output format is stable and scriptable, documentation and READMEs quote tree -L 2 verbatim, and it needs no special font.

Alternative to

AlternativeTypeTrade-off
eza –tree or lsd –treeOpen sourceThe same view from a tool you may already have
brootOpen sourceAn interactive tree that can navigate and act, not just print
findBuilt inNo tree drawing, but it is everywhere and it composes

Install

brew install tree

Links

This post is licensed under CC BY 4.0 by the author.
Last updated on