rich-tree is packed with features that go far beyond the classic tree command. This page explains each feature in detail.
Every file and directory is displayed with a visually distinct Nerd Font icon and matching color. Icons are selected based on:
README.md β book icon, Dockerfile β Docker whale).py β Python snake, .rs β Rust gear)src β source icon, docs β document icon)Over 220 file type extensions and 40+ named folders and files are covered.
See the full Icon System reference.
Every icon has an associated color chosen to match the language or tool it represents:
| Color | Examples |
|---|---|
Python blue #4b8bbe |
.py, .pyc |
JavaScript yellow #e7d535 |
.js, .mjs |
TypeScript blue #3a73be |
.ts, .tsx |
Rust orange #e64619 |
.rs, .rlib |
HTML orange #f06529 |
.htm, .html, .xhtml |
CSS blue #375ee2 |
.css |
Go cyan #27a3ca |
.go |
Markdown blue #50a4f2 |
.md, .markdown |
Dimmed colors are used for hidden, gitignored, or __dunder__ directories to visually differentiate them from regular content.
File names in the tree are clickable hyperlinks in terminals that support OSC 8 hyperlinks (e.g., iTerm2, Kitty, Wezterm, GNOME Terminal, Windows Terminal).
Clicking a filename opens the file in your systemβs default application.
The root directory label is also a clickable link to the directory itself.
You can display extra information alongside each file with these flags:
--show-size / -ss)Shows human-readable file size in decimal format:
main.py (12.4 kB)
data.csv (1.2 MB)
Sizes are colored blue for regular files, and dimmed for hidden/ignored files.
--show-created / -sc)Shows when the file was created:
main.py (created: 2024-01-15 09:23:41)
Colored cyan.
--show-modified / -sm)Shows when the file was last modified:
main.py (modified: 2024-06-30 14:55:12)
Colored green.
--show-accessed / -sa)Shows when the file was last accessed:
main.py (accessed: 2024-07-01 08:10:44)
Colored yellow.
All metadata flags can be combined:
rtree -ss -sc -sm -sa
Output:
main.py (12.4 kB, created: 2024-01-15 09:23:41, modified: 2024-06-30 14:55:12, accessed: 2024-07-01 08:10:44)
Timestamps use the format YYYY-MM-DD HH:MM:SS in local time.
Run rtree --show-git (or -sg) to overlay git status on every file in the tree. This is incredibly useful for quickly seeing whatβs changed in a project.
rtree -sg
Output example:
π project
βββ π main.py [M] β modified
βββ π new_feature.py [A] β staged/added
βββ π old.py [D] β deleted
βββ π scratch.py [??] β untracked
Status code colors:
| Status | Code | Color | Description |
|---|---|---|---|
| Modified | M |
Yellow | File changed but not staged, or staged changes |
| Added | A |
Green | New file staged for commit |
| Deleted | D |
Red | File deleted |
| Untracked | ?? |
Magenta | New file, not tracked by git |
| Renamed | R |
Green | File renamed |
| Copied | C |
Green | File copied |
| Unmerged | U |
Red | Merge conflict |
Requirements:
git must be installed and on your PATHIf git is not available or the directory is not a git repo, the flag is silently ignored (no error is shown).
How it works:
rich-tree runs git status --porcelain -z from the git repository root and builds a mapping of file paths to status codes. Renamed/copied files (which have two paths in the output) are correctly handled.
By default, rich-tree reads .gitignore files at every level of the tree and hides matched files β just like git itself does.
.gitignore files (at different directory levels) are stacked and applied hierarchically.!)/)/)*, ?, **)To disable gitignore filtering:
rtree --no-gitignore
By default, dotfiles (files/folders starting with .) that are not in the βimportant dotfilesβ whitelist are hidden. Use --ignore-dot to also hide the whitelisted ones, or --all to show everything.
Important dotfiles that are never hidden by default:
| File | Purpose |
|---|---|
.gitignore |
Git ignore rules |
.gitattributes |
Git attributes |
.editorconfig |
Editor configuration |
.env |
Environment variables |
.env.example |
Environment variable template |
.env.local |
Local environment overrides |
.env.development |
Development environment |
.env.production |
Production environment |
.npmrc |
npm configuration |
.babelrc |
Babel configuration |
.eslintrc |
ESLint configuration |
.eslintrc.json |
ESLint configuration (JSON) |
.prettierrc |
Prettier configuration |
.vscodeignore |
VS Code extension ignore |
--exclude / -e)Exclude specific folder or file names by providing a comma-separated list. The default exclusion list is venv,node_modules,.git,.history.
rtree -e dist,build,__pycache__
Note: Specifying
--excludereplaces the entire default list. To keep defaults and add more, include them explicitly:rtree -e venv,node_modules,.git,.history,dist,build
--all / -a)Override all filtering (hidden files, gitignore rules) and show every file:
rtree --all
rtree -a
Limit how many levels deep the tree recurses with --depth / -d:
rtree -d 1 # only immediate children
rtree -d 2 # two levels deep
rtree -d 3 # three levels deep
A depth of -1 (default) means unlimited recursion.
Save the tree as a self-contained HTML file with all colors and styles preserved:
rtree -o output.html
rtree --export-html /tmp/project-snapshot.html
The HTML file can be:
--width / -w)Force the output to fit within a specific number of characters:
rtree -w 100
--soft)Enable soft (word-boundary) text wrapping instead of truncating at the terminal edge:
rtree --soft
Run the interactive setup wizard for guided configuration:
rtree --onboard
The wizard covers:
tree β rtreeSee the full Onboarding Wizard guide.
Directories always appear before files in each level. Within each group (directories and files separately), entries are sorted case-insensitively by name.
stat()-ed for metadata are skipped gracefully.git status errors (no git, not a repo) are silently ignored.os.scandir() for fast directory iteration.Preparing⦠/ Processing [file]) is shown while the tree is being built.git status --porcelain -z call..gitignore files are parsed lazily as directories are traversed.