Interactive CLI directory tree visualizer with treemap view
npm install tri-cliA terminal-based interactive directory visualizer, like tree but with keyboard navigation, shortcuts, colors, and treemap visuals:
It's recommended to install globally:
``bash`
npm install -g tri-cli
After global installation, you can run tri directly from anywhere:
`bash`
tri .
If you don't want to install globally, you can install locally and then run anywhere with npx:
`bash`
npm install tri-cli
For local installations, use npx to run the command:
`bash`
npx tri .
Or add it to your package.json scripts:
`json`
{
"scripts": {
"tree": "tri"
}
}
Then run with npm run tree.
`bash`
tri [directory] [options]
`bash`
tri . # visualize current directory
tri ../bionemo -L 2 # show 2 levels deep
tri --dir src # specify directory with flag
tri src -s # preload all sizes (enables immediate treemap)
tri --dir src -c # start with all directories collapsed
| Key | Action |
| ------------- | ----------------------------------------- |
| ↑ / ↓ | Navigate files and folders |
| Enter | Expand or collapse a directory |
| [a-z]/[0-9] | Type shortcut to jump to item |
| d | Calculate and display sizes recursively |
| l | Show last modified dates (ls -l style) |
| m | Toggle treemap view |
| Esc | Clear typed shortcut |
| q | Quit |
| Option | Description |
| ---------------- | ------------------------------------------------ |
| [directory] | Directory to visualize (default: current dir) |-L
| | Maximum depth to load initially (default: 1) |-s, --size
| | Preload all file/directory sizes |-c, --collapse
| | Start with all directories collapsed |-h, --help
| | Show help message |
on any item to calculate disk usage recursively
- Date display: Press l to show last modified dates in ls -l format$3
- Press m to visualize the selected directory as a treemap
- Visual representation of file/directory sizes
- Hierarchical rectangles sized proportionally to disk usage
- Color-coded by file type or directory groupDevelopment
Clone the repository and install dependencies:
`bash
git clone https://github.com/jwilber/tri-cli.git
cd tri-cli
npm install
`Build and link for local development:
`bash
npm run build
npm link
`Now you can run
tri` from anywhere and it will use your local development version.MIT
Jared Wilber