Show a directory tree
low risk
Prints directories and files as an indented tree. Useful for understanding project layouts.
| Flag | Meaning |
|---|---|
-L | Limit depth to N levels |
-a | Include hidden files |
-d | Directories only |
-I | Exclude entries matching a pattern |
-h | Human-readable sizes |
tree -L 2Two levels deep · explain & risk-check →tree -a -I ".git|node_modules"Include dotfiles but skip noise · explain & risk-check →Use -L on large trees — an unbounded tree of / floods the terminal.
Reference text is hand-written and may be incomplete — check man tree for your version. Test destructive commands on a non-production system first.