A modern reimagining of the classic tree command — designed to actually show you what you're looking for.
tree has been around since the 80s and the interface shows it. newtree keeps everything familiar but fixes the parts that never made sense, and adds the features you'd expect from a modern tool: icons, color, a live-search TUI, and pattern filtering that actually prunes the output instead of lying to you.
Use it as nt for day-to-day use, or newtree to see the help.
The classic tree command's -P pattern filter is misleading — it still expands every directory, just showing zero matching files inside them:
$ tree ~/project -P "*.rs" -L 3
/home/user/project
├── benches
├── examples
│ ├── basic
│ └── advanced
...
47 directories, 0 files
newtree prunes the tree to only show paths that actually lead to a match:
$ nt ~/project -P .rs -L 3
project
├── src
│ ├── main.rs
│ ├── lib.rs
│ └── utils.rs
├── benches
│ └── bench.rs
├── examples
│ ├── basic.rs
│ └── advanced.rs
...
6 directories, 12 files
# AUR
yay -S newtree
# From source
cargo install --path .nt [OPTIONS] [PATH]
| Flag | Description |
|---|---|
-a |
Show hidden files |
-d |
Directories only |
-l |
Follow symlinks |
-f |
Print full paths |
-x |
Stay on one filesystem |
-L <N> |
Limit depth to N |
-P <PATTERN> |
Show only entries matching pattern |
-I <PATTERN> |
Exclude entries matching pattern |
--prune |
Prune empty directories |
| Flag | Description |
|---|---|
-v |
Natural/version sort |
-t |
Sort by modification time |
-c |
Sort by status change time |
-U |
Unsorted |
-r |
Reverse sort order |
| Flag | Description |
|---|---|
-s |
Show file sizes |
-H |
Human-readable sizes |
-p |
Show permissions |
-D |
Show last modified date |
Nerd Font icons are shown by default when outputting to a terminal. Requires a Nerd Font in your terminal emulator.
nt # icons on by default in TTY
nt --no-icons # disable icons
nt --icons # force icons even when pipednt --color=always # full file-type colors
nt --color=auto # smart: detects piped output, busy flags (default)
nt --color=simple # directories and symlinks only
nt --color=never # no color--color=auto (the default) will:
- Use no color when output is piped
- Use simple color when
--permissionsor--dateare active (avoids visual noise) - Use full color otherwise
nt --json # JSON
nt --xml # XML
nt --tui # Interactive live-search TUI
nt --tui --search foo # TUI with pre-filled searchMIT