tree

Draw a directory hierarchy as an indented diagram

About

Renders a folder as a branching diagram. The shape of a project becomes visible at a glance. It can cap the depth, filter by pattern and print sizes.

Install it

pkg install tree

Run this inside Termux. If the package is already present, pkg will say so and do nothing.

Commands worth knowing

6 of the invocations you will actually reach for. Tap the copy button to put one on your clipboard.

tree -L 2 Limit the diagram to two levels. A large project will not flood the screen.
tree -a Include hidden dotfiles and folders in the output.
tree -h Append a human-readable size to each entry.
tree -d Directories only. You get a map of the folder skeleton.
tree -I "node_modules|.git" Exclude any path matching the patterns. Keeps the diagram focused.
tree -P "*.ts" Print only entries matching the pattern. Parent folders still appear.

Worked example

Run tree -L 1 and this is what you should see.

termux
$ tree -L 1
.
├── docs
├── scripts
├── src
└── README.md

3 directories, 1 file

Developed by

Steve Baker .