{"id":28801394,"url":"https://github.com/bgreenwell/lstr","last_synced_at":"2026-01-21T13:25:25.616Z","repository":{"id":297665550,"uuid":"997508788","full_name":"bgreenwell/lstr","owner":"bgreenwell","description":"A fast, minimalist directory tree viewer, written in Rust.","archived":false,"fork":false,"pushed_at":"2025-09-07T04:09:48.000Z","size":3328,"stargazers_count":1394,"open_issues_count":14,"forks_count":26,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-01-19T22:33:08.513Z","etag":null,"topics":["cli","command-line","command-line-tool","developer-tools","filesystem","git","ls","nerd-fonts","rust-lang","tree","tui"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/lstr","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bgreenwell.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-06T16:43:27.000Z","updated_at":"2026-01-18T20:34:39.000Z","dependencies_parsed_at":"2025-07-14T17:26:42.748Z","dependency_job_id":"14fe2fc5-d8eb-49e3-a232-1211ee232e7b","html_url":"https://github.com/bgreenwell/lstr","commit_stats":null,"previous_names":["bgreenwell/lsrt","bgreenwell/lstr"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/bgreenwell/lstr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgreenwell%2Flstr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgreenwell%2Flstr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgreenwell%2Flstr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgreenwell%2Flstr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bgreenwell","download_url":"https://codeload.github.com/bgreenwell/lstr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgreenwell%2Flstr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28633757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","command-line-tool","developer-tools","filesystem","git","ls","nerd-fonts","rust-lang","tree","tui"],"created_at":"2025-06-18T07:09:27.274Z","updated_at":"2026-01-21T13:25:25.599Z","avatar_url":"https://github.com/bgreenwell.png","language":"Rust","readme":"# lstr\n\n[![Build Status](https://github.com/bgreenwell/lstr/actions/workflows/ci.yml/badge.svg)](https://github.com/bgreenwell/lstr/actions)\n[![Latest Version](https://img.shields.io/crates/v/lstr.svg)](https://crates.io/crates/lstr)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA fast, minimalist directory tree viewer, written in Rust. Inspired by the command line program [tree](https://github.com/Old-Man-Programmer/tree), with a powerful interactive mode.\n\n![](assets/lstr-demo.gif)\n\n*An interactive overview of a project's structure using `lstr`.*\n\n## Philosophy\n\n  - **Minimalist:** Provides essential features without the bloat. The core experience is clean and uncluttered.\n  - **Interactive:** An optional TUI mode for fluid, keyboard-driven exploration.\n\n## Features\n\n  - **Classic and interactive modes:** Use `lstr` for a classic `tree`-like view, or launch `lstr interactive` for a fully interactive TUI.\n  - **Theme-aware coloring:** Respects your system's `LS_COLORS` environment variable for fully customizable file and directory colors.\n  - **Rich information display (optional):**\n      - Display file-specific icons with `--icons` (requires a Nerd Font).\n      - Show file permissions with `-p`.\n      - Show file sizes with `-s`.\n      - **Git Integration:** Show file statuses (`Modified`, `New`, `Untracked`, etc.) directly in the tree with the `-G` flag.\n  - **Smart filtering:**\n      - Respects your `.gitignore` files with the `-g` flag.\n      - Control recursion depth (`-L`) or show only directories (`-d`).\n\n## Installation\n\n### With Homebrew (macOS)\n\nThe easiest way to install `lstr` on macOS is with Homebrew.\n\n```zsh\nbrew install lstr\n```\n\n### From source (all platforms)\n\nYou need the Rust toolchain installed on your system to build `lstr`.\n\n1.  **Clone the repository:**\n    ```bash\n    git clone https://github.com/bgreenwell/lstr.git\n    cd lstr\n    ```\n2.  **Build and install using Cargo:**\n    ```bash\n    cargo install --path .\n    ```\n\n### NetBSD\n\nOn NetBSD a package is available from the official repositories. To install it, simply run:\n\n```bash\npkgin install lstr\n```\n\n## Usage\n\n```bash\nlstr [OPTIONS] [PATH]\nlstr interactive [OPTIONS] [PATH]\n```\n\nNote that `PATH` defaults to the current directory (`.`) if not specified.\n\n| Option                 | Description                                                                 |\n| :--------------------- | :-------------------------------------------------------------------------- |\n| `-a`, `--all`          | List all files and directories, including hidden ones.                      |\n| `--color \u003cWHEN\u003e`       | Specify when to use color output (`always`, `auto`, `never`).               |\n| `-d`, `--dirs-only`    | List directories only, ignoring all files.                                  |\n| `-g`, `--gitignore`    | Respect `.gitignore` and other standard ignore files.                       |\n| `-G`, `--git-status`   | Show git status for files and directories.                                  |\n| `--icons`              | Display file-specific icons; requires a [Nerd Font](https://www.nerdfonts.com/). |\n| `--hyperlinks`         | Render file paths as clickable hyperlinks (classic mode only)               |\n| `-L`, `--level \u003cLEVEL\u003e`| Maximum depth to descend.                                                   |\n| `-p`, `--permissions`  | Display file permissions (Unix-like systems only).                          |\n| `-s`, `--size`         | Display the size of files.                                                  |\n| `--sort \u003cTYPE\u003e`        | Sort entries by the specified criteria (`name`, `size`, `modified`, `extension`). |\n| `--dirs-first`         | Sort directories before files.                                              |\n| `--case-sensitive`     | Use case-sensitive sorting.                                                 |\n| `--natural-sort`       | Use natural/version sorting (e.g., file1 \u003c file10).                        |\n| `-r`, `--reverse`      | Reverse the sort order.                                                     |\n| `--dotfiles-first`     | Sort dotfiles and dotfolders first (dotfolders → folders → dotfiles → files). |\n| `--expand-level \u003cLEVEL\u003e`| **Interactive mode only:** Initial depth to expand the interactive tree.   |\n\n-----\n\n## Interactive mode\n\nLaunch the TUI with `lstr interactive [OPTIONS] [PATH]`.\n\n### Keyboard controls\n\n| Key(s)  | Action                                                                                                                                      |\n| :------ | :------------------------------------------------------------------------------------------------------------------------------------------ |\n| `↑` / `k` | Move selection up. |\n| `↓` / `j` | Move selection down. |\n| `Enter` | **Context-aware action:**\\\u003cbr\\\u003e- If on a file: Open it in the default editor (`$EDITOR`).\\\u003cbr\\\u003e- If on a directory: Toggle expand/collapse. |\n| `q` / `Esc` | Quit the application normally. |\n| `Ctrl`+`s` | **Shell integration:** Quits and prints the selected path to stdout. |\n\n## Examples\n\n**1. List the contents of the current directory**\n\n```bash\nlstr\n```\n\n**2. Explore a project interactively, ignoring gitignored files**\n\n```bash\nlstr interactive -g --icons\n```\n\n**3. Display a directory with file sizes and permissions (classic view)**\n\n```bash\nlstr -sp\n```\n\n**4. See the git status of all files in a project**\n\n```bash\nlstr -aG\n```\n\n**5. Get a tree with clickable file links (in a supported terminal)**\n\n```bash\nlstr --hyperlinks\n```\n\n**6. Start an interactive session with all data displayed**\n\n```bash\nlstr interactive -gG --icons -s -p\n```\n\n**7. Sort files naturally with directories first**\n\n```bash\nlstr --dirs-first --natural-sort\n```\n\n**8. Sort by file size in descending order**\n\n```bash\nlstr --sort size --reverse\n```\n\n**9. Sort by extension with case-sensitive ordering**\n\n```bash\nlstr --sort extension --case-sensitive\n```\n\n**10. Sort with dotfiles first and directories first**\n\n```bash\nlstr --dotfiles-first --dirs-first -a\n```\n\n## Piping and shell interaction\n\nThe classic `view` mode is designed to work well with other command-line tools via pipes (`|`).\n\n### Interactive fuzzy finding with `fzf`\n\nThis is a powerful way to instantly find any file in a large project.\n\n```bash\nlstr -a -g --icons | fzf\n```\n\n`fzf` will take the tree from `lstr` and provide an interactive search prompt to filter it.\n\n### Paging large trees with `less` or `bat`\n\nIf a directory is too large to fit on one screen, pipe the output to a *pager*.\n\n```bash\n# Using less (the -R flag preserves color)\nlstr -L 10 | less -R\n\n# Using bat (a modern pager that understands colors)\nlstr --icons | bat\n```\n\n### Changing directories with `lstr`\n\nYou can use `lstr` as a visual `cd` command. Add the following function to your shell's startup file (e.g., `~/.bashrc`, `~/.zshrc`):\n\n```bash\n# A function to visually change directories with lstr\nlcd() {\n    # Run lstr and capture the selected path into a variable.\n    # The TUI will draw on stderr, and the final path will be on stdout.\n    local selected_dir\n    selected_dir=\"$(lstr interactive -g --icons)\"\n\n    # If the user selected a path (and didn't just quit), `cd` into it.\n    # Check if the selection is a directory.\n    if [[ -n \"$selected_dir\" \u0026\u0026 -d \"$selected_dir\" ]]; then\n        cd \"$selected_dir\"\n    fi\n}\n```\n\nAfter adding this and starting a new shell session (or running `source ~/.bashrc`), you can simply run:\n\n```bash\nlcd\n```\n\nThis will launch the `lstr` interactive UI. Navigate to the directory you want, press `Ctrl+s`, and your shell's current directory will instantly change.\n\n## Color customization\n\n`lstr` respects your terminal's color theme by default. It reads the `LS_COLORS` environment variable to colorize files and directories according to your system's configuration. This is the same variable used by GNU `ls` and other modern command-line tools.\n\n### Linux\n\nOn most Linux distributions, this variable is already set. You can customize it by modifying your shell's startup file.\n\n### macOS\n\nmacOS does not set the `LS_COLORS` variable by default. To enable this feature, you can install `coreutils`:\n\n```bash\nbrew install coreutils\n````\n\nThen, add the following line to your shell's startup file (e.g., `~/.zshrc` or `~/.bash_profile`):\n\n```bash\n# Use gdircolors from the newly installed coreutils\neval \"$(gdircolors)\"\n```\n\n### Windows\n\nWindows does not use the `LS_COLORS` variable natively, but you can set it manually to enable color support in modern terminals like Windows Terminal.\n\nFirst, copy a standard `LS_COLORS` string, such as this one:\n`rs=0:di=01;34:ln=01;36:ex=01;32:*.zip=01;31:*.png=01;35:`. This string defines colors for various file types:\n\n* **Directories:** Displayed in **bold blue**.\n* **Executable files:** Displayed in **bold green** (e.g., `.sh` scripts).\n* **Symbolic links:** Displayed in **bold cyan**.\n* **Archives:** Displayed in **bold red** (e.g., `.zip`, `.tar.gz`).\n* **Image files:** Displayed in **bold magenta** (e.g., `.png`, `.jpg`).\n* **Other files:** Displayed in the terminal's default text color.\n\nTo set it for your current **PowerShell** session, run:\n\n```powershell\n$env:LS_COLORS=\"rs=0:di=01;34:ln=01;36:ex=01;32:*.zip=01;31:*.png=01;35:\"\n```\n\nTo set it for your current **Command Prompt** (cmd) session, run:\n\n```cmd\nset LS_COLORS=rs=0:di=01;34:ln=01;36:ex=01;32:*.zip=01;31:*.png=01;35:\n```\n\nTo make the setting permanent, you can add the command to your PowerShell profile or set it in the system's \"Environment Variables\" dialog.\n\nAfter setting the variable and starting a new shell session, `lstr` will automatically display your configured colors.\n\n## Inspiration\n\nThe philosophy and functionality of `lstr` are heavily inspired by the excellent C-based [tree](https://github.com/Old-Man-Programmer/tree) command line program. This project is an attempt to recreate that classic utility in modern, safe Rust.\n\n## License\n\nThis project is licensed under the terms of the [MIT License](https://www.google.com/search?q=LICENSE).\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgreenwell%2Flstr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbgreenwell%2Flstr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgreenwell%2Flstr/lists"}