Close Menu

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Solo.io wins ‘most likely to succeed’ award at VB Transform 2025 innovation showcase

    The great AI agent acceleration: Why enterprise adoption is happening faster than anyone predicted

    $8.8 trillion protected: How one CISO went from ‘that’s BS’ to bulletproof in 90 days

    Facebook X (Twitter) Instagram
    • Artificial Intelligence
    • Business Technology
    • Cryptocurrency
    • Gadgets
    • Gaming
    • Health
    • Software and Apps
    • Technology
    Facebook X (Twitter) Instagram Pinterest Vimeo
    Tech AI Verse
    • Home
    • Artificial Intelligence

      Apple sued by shareholders for allegedly overstating AI progress

      June 22, 2025

      How far will AI go to defend its own survival?

      June 2, 2025

      The internet thinks this video from Gaza is AI. Here’s how we proved it isn’t.

      May 30, 2025

      Nvidia CEO hails Trump’s plan to rescind some export curbs on AI chips to China

      May 22, 2025

      AI poses a bigger threat to women’s work, than men’s, report says

      May 21, 2025
    • Business

      Cloudflare open-sources Orange Meets with End-to-End encryption

      June 29, 2025

      Google links massive cloud outage to API management issue

      June 13, 2025

      The EU challenges Google and Cloudflare with its very own DNS resolver that can filter dangerous traffic

      June 11, 2025

      These two Ivanti bugs are allowing hackers to target cloud instances

      May 21, 2025

      How cloud and AI transform and improve customer experiences

      May 10, 2025
    • Crypto

      MoonPay Executives Might Have Fallen for $250,000 Trump-Themed Crypto Scam

      July 11, 2025

      Top 3 Altcoins Trending in Nigeria This Week

      July 11, 2025

      Tether is Removing USDT From These 5 Legacy Blockchains

      July 11, 2025

      HBAR Faces Final Hurdle After Explosive Rally; Are Bulls Tiring Out?

      July 11, 2025

      OKX Europe CEO Discusses Bitcoin’s Breakout Rally | US Crypto News

      July 11, 2025
    • Technology

      Solo.io wins ‘most likely to succeed’ award at VB Transform 2025 innovation showcase

      July 11, 2025

      The great AI agent acceleration: Why enterprise adoption is happening faster than anyone predicted

      July 11, 2025

      $8.8 trillion protected: How one CISO went from ‘that’s BS’ to bulletproof in 90 days

      July 11, 2025

      AWS doubles down on infrastructure as strategy in the AI race with SageMaker upgrades

      July 11, 2025

      The best Amazon Prime Day deals for the last day: Our top picks on headphones, TVs, robot vacuums and more

      July 11, 2025
    • Others
      • Gadgets
      • Gaming
      • Health
      • Software and Apps
    Shop Now
    Tech AI Verse
    You are at:Home»Technology»Show HN: Lstr – A modern, interactive tree command written in Rust
    Technology

    Show HN: Lstr – A modern, interactive tree command written in Rust

    TechAiVerseBy TechAiVerseJune 18, 2025No Comments4 Mins Read0 Views
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    Show HN: Lstr – A modern, interactive tree command written in Rust
    Share
    Facebook Twitter LinkedIn Pinterest WhatsApp Email

    Show HN: Lstr – A modern, interactive tree command written in Rust

    lstr



    A blazingly fast, minimalist directory tree viewer, written in Rust. Inspired by the command line program tree, with a powerful interactive mode.


    An interactive overview of lstr‘s project structure… using lstr.

    Philosophy

    • Fast: Runs directory scans in parallel by default to maximize speed on modern hardware.
    • Minimalist: Provides essential features without the bloat. The core experience is clean and uncluttered.
    • Interactive: An optional TUI mode for fluid, keyboard-driven exploration.

    Features

    • High-performance: Scans directories in parallel to be as fast as possible.
    • Classic and interactive modes: Use lstr for a classic tree-like view, or launch lstr interactive for a fully interactive TUI.
    • Rich information display (optional):
      • Display file-specific icons with --icons (requires a Nerd Font).
      • Show file permissions with -p.
      • Show file sizes with -s.
      • Git Integration: Show file statuses (Modified, New, Untracked, etc.) directly in the tree with the -G flag.
    • Smart filtering:
      • Respects your .gitignore files with the -g flag.
      • Control recursion depth (-L) or show only directories (-d).

    Installation

    You need the Rust toolchain installed on your system to build lstr.

    1. Clone the repository:

      git clone https://github.com/bgreenwell/lstr.git
      cd lstr
    2. Build and install using Cargo:

      # This compiles in release mode and copies the binary to ~/.cargo/bin
      cargo install --path .

    Usage

    lstr [OPTIONS] [PATH]
    lstr interactive [OPTIONS] [PATH]

    Note that PATH defaults to the current directory (.) if not specified.

    Option Description
    -a, --all List all files and directories, including hidden ones.
    --color Specify when to use color output (always, auto, never).
    -d, --dirs-only List directories only, ignoring all files.
    -g, --gitignore Respect .gitignore and other standard ignore files.
    -G, --git-status Show git status for files and directories.
    --icons Display file-specific icons; requires a Nerd Font.
    -L, --level Maximum depth to descend.
    -p, --permissions Display file permissions (Unix-like systems only).
    -s, --size Display the size of files.
    --expand-level Interactive mode only: Initial depth to expand the interactive tree.


    Interactive mode

    Launch the TUI with lstr interactive [OPTIONS] [PATH].

    Keyboard controls

    Key(s) Action
    ↑ / k Move selection up.
    ↓ / j Move selection down.
    Enter Context-aware action:
    – If on a file: Open it in the default editor ($EDITOR).
    – If on a directory: Toggle expand/collapse.
    q / Esc Quit the application normally.
    Ctrl+s Shell integration: Quits and prints the selected path to stdout.

    Examples

    1. List the contents of the current directory

    2. Explore a project interactively, ignoring gitignored files

    lstr interactive -g --icons

    3. Display a directory with file sizes and permissions (classic view)

    4. See the git status of all files in a project

    5. Start an interactive session with all data displayed

    lstr interactive -gG --icons -s -p

    Piping and shell interaction

    The classic view mode is designed to work well with other command-line tools via pipes (|).

    Interactive fuzzy finding with fzf

    This is a powerful way to instantly find any file in a large project.

    fzf will take the tree from lstr and provide an interactive search prompt to filter it.

    Paging large trees with less or bat

    If a directory is too large to fit on one screen, pipe the output to a pager.

    # Using less (the -R flag preserves color)
    lstr -L 10 | less -R
    
    # Using bat (a modern pager that understands colors)
    lstr --icons | bat

    Changing directories with lstr

    You can use lstr as a visual cd command. Add the following function to your shell’s startup file (e.g., ~/.bashrc, ~/.zshrc):

    # A function to visually change directories with lstr
    lcd() {
        # Run lstr and capture the selected path into a variable.
        # The TUI will draw on stderr, and the final path will be on stdout.
        local selected_dir
        selected_dir="$(lstr interactive -g --icons)"
    
        # If the user selected a path (and didn't just quit), `cd` into it.
        # Check if the selection is a directory.
        if [[ -n "$selected_dir" && -d "$selected_dir" ]]; then
            cd "$selected_dir"
        fi
    }

    After adding this and starting a new shell session (or running source ~/.bashrc), you can simply run:

    This will launch the lstr interactive UI. Navigate to the directory you want, press Ctrl+s, and your shell’s current directory will instantly change.

    Performance and concurrency

    By default, lstr uses a parallel directory walker to maximize speed on multi-core systems. This parallelism is managed by the excellent rayon thread pool, which is used internally by lstr‘s directory traversal engine.

    For advanced use cases, such as benchmarking or limiting CPU usage, you can control the number of threads by setting the RAYON_NUM_THREADS environment variable before running the command.

    To force single-threaded (serial) execution:

    RAYON_NUM_THREADS=1 lstr .

    Inspiration

    The philosophy and functionality of lstr are heavily inspired by the excellent C-based tree command line program. This project is an attempt to recreate that classic utility in modern, safe Rust.

    Share. Facebook Twitter Pinterest LinkedIn Reddit WhatsApp Telegram Email
    Previous ArticleShow HN: Rulebook AI – rules and memory manager for AI coding IDEs
    Next Article OpenSERDES – Open Hardware Serializer/Deserializer (SerDes) in Verilog
    TechAiVerse
    • Website

    Jonathan is a tech enthusiast and the mind behind Tech AI Verse. With a passion for artificial intelligence, consumer tech, and emerging innovations, he deliver clear, insightful content to keep readers informed. From cutting-edge gadgets to AI advancements and cryptocurrency trends, Jonathan breaks down complex topics to make technology accessible to all.

    Related Posts

    Solo.io wins ‘most likely to succeed’ award at VB Transform 2025 innovation showcase

    July 11, 2025

    The great AI agent acceleration: Why enterprise adoption is happening faster than anyone predicted

    July 11, 2025

    $8.8 trillion protected: How one CISO went from ‘that’s BS’ to bulletproof in 90 days

    July 11, 2025
    Leave A Reply Cancel Reply

    Top Posts

    New Akira ransomware decryptor cracks encryptions keys using GPUs

    March 16, 202528 Views

    OpenAI details ChatGPT-o3, o4-mini, o4-mini-high usage limits

    April 19, 202522 Views

    6.7 Cummins Lifter Failure: What Years Are Affected (And Possible Fixes)

    April 14, 202519 Views

    Rsync replaced with openrsync on macOS Sequoia

    April 7, 202519 Views
    Don't Miss
    Technology July 11, 2025

    Solo.io wins ‘most likely to succeed’ award at VB Transform 2025 innovation showcase

    Solo.io wins ‘most likely to succeed’ award at VB Transform 2025 innovation showcase July 11,…

    The great AI agent acceleration: Why enterprise adoption is happening faster than anyone predicted

    $8.8 trillion protected: How one CISO went from ‘that’s BS’ to bulletproof in 90 days

    AWS doubles down on infrastructure as strategy in the AI race with SageMaker upgrades

    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • YouTube
    • Vimeo

    Subscribe to Updates

    Get the latest creative news from SmartMag about art & design.

    About Us
    About Us

    Welcome to Tech AI Verse, your go-to destination for everything technology! We bring you the latest news, trends, and insights from the ever-evolving world of tech. Our coverage spans across global technology industry updates, artificial intelligence advancements, machine learning ethics, and automation innovations. Stay connected with us as we explore the limitless possibilities of technology!

    Facebook X (Twitter) Pinterest YouTube WhatsApp
    Our Picks

    Solo.io wins ‘most likely to succeed’ award at VB Transform 2025 innovation showcase

    July 11, 20251 Views

    The great AI agent acceleration: Why enterprise adoption is happening faster than anyone predicted

    July 11, 20252 Views

    $8.8 trillion protected: How one CISO went from ‘that’s BS’ to bulletproof in 90 days

    July 11, 20252 Views
    Most Popular

    Ethereum must hold $2,000 support or risk dropping to $1,850 – Here’s why

    March 12, 20250 Views

    Xiaomi 15 Ultra Officially Launched in China, Malaysia launch to follow after global event

    March 12, 20250 Views

    Apple thinks people won’t use MagSafe on iPhone 16e

    March 12, 20250 Views
    © 2025 TechAiVerse. Designed by Divya Tech.
    • Home
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms & Conditions

    Type above and press Enter to search. Press Esc to cancel.