lstr: A Fast, Minimalist Directory Tree Viewer Written in Rust
Summary
lstr is a high-performance, minimalist command-line utility for viewing directory trees, built with Rust. It offers both a classic `tree`-like output and a powerful interactive Text User Interface (TUI) mode for fluid exploration. With features like Git integration, icon support, and smart filtering, lstr provides an efficient way to understand project structures.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
lstr is a modern, fast, and minimalist directory tree viewer written in Rust. Inspired by the classic tree command, lstr enhances the experience with a powerful interactive mode and a focus on performance. It's designed to provide essential features without bloat, making it an ideal tool for developers and anyone needing to quickly visualize file system structures.
Key features include:
- Classic and Interactive Modes: Choose between a traditional
tree-like output or a fully interactive TUI for keyboard-driven exploration. - Theme-aware Coloring: Respects your system's
LS_COLORSenvironment variable for customizable file and directory colors. - Rich Information Display: Optionally show file-specific icons (requires a Nerd Font), permissions, sizes, and Git statuses.
- Smart Filtering: Integrates with
.gitignorefiles and allows control over recursion depth.
Installation
Installing lstr is straightforward across various platforms.
With Homebrew (macOS)
For macOS users, Homebrew provides the easiest installation method:
brew install lstr
From Source (All Platforms)
If you have the Rust toolchain installed, you can build and install lstr from its source code:
Clone the repository:
git clone https://github.com/bgreenwell/lstr.git cd lstrBuild and install using Cargo:
cargo install --path .
NetBSD
NetBSD users can install lstr directly from official repositories:
pkgin install lstr
Examples
Here are a few examples demonstrating lstr's versatility:
1. Explore a project interactively, ignoring gitignored files and showing icons:
lstr interactive -g --icons
2. Display a directory with file sizes and permissions in classic view:
lstr -sp
3. See the Git status of all files in a project:
lstr -aG
4. Get a tree with clickable file links (in a supported terminal):
lstr --hyperlinks
5. Sort files naturally with directories first:
lstr --dirs-first --natural-sort
Why Use lstr?
lstr offers several compelling reasons to integrate it into your workflow:
- Performance: Written in Rust, lstr is inherently fast and efficient, handling large directories with ease.
- Interactivity: The optional TUI mode provides a dynamic, keyboard-driven way to navigate and explore your file system, a significant upgrade from static
treeoutput. - Developer-Friendly: Features like Git status integration,
.gitignoresupport, and customizable output make it an invaluable tool for managing codebases. - Customization: Full support for
LS_COLORSensures that lstr integrates seamlessly with your existing terminal theme and preferences. - Minimalist Design: It focuses on core functionality without unnecessary complexity, providing a clean and uncluttered user experience.
Links
- GitHub Repository: https://github.com/bgreenwell/lstr
- Crates.io: https://crates.io/crates/lstr