How to Use the broot Command in Linux for Fast Directory Navigation and Overview

Navigating deeply nested file trees in the Linux terminal using traditional utilities like ls, find, and tree often leads to cognitive overload. Running the classic tree command inside a modern software repository or server root dumps thousands of lines of output across your screen, forcing you to scroll endlessly or pipe output through a pager just to locate a single configuration file.

broot solves this problem by providing an interactive, balanced directory tree view designed to fit perfectly within your active terminal window. Regardless of how many thousands of files exist on disk, broot never overflows your screen. It automatically prunes uninteresting branches, supports real-time fuzzy searching, provides inline file previews, and integrates with your shell to let you jump directly between project directories.

How broot Balances Tree Views

Unlike standard tree tools that exhaustively list every file until they run out of directories, broot calculates how many vertical lines are available in your terminal window and dynamically adjusts the tree structure:

  • No Screen Overflow: broot displays only as many lines as your terminal window can show, collapsing sprawling subdirectories into compact indicators (e.g. “12 files not shown”).
  • Dynamic Unpruning: As you type search letters, broot immediately unprunes and expands the exact branches matching your query while collapsing non-matching folders.
  • File System Intelligence: It respects your .gitignore rules by default, hiding build artefacts like node_modules, target, or __pycache__ unless explicitly instructed to reveal them.
  • Safe File Operations: You can move, delete, create, and inspect permissions without exiting back to the standard shell prompt.

Installing broot on Linux

broot is written in Rust and packaged across major Linux distributions.

Installing on Ubuntu, Debian, and Linux Mint

On modern Debian and Ubuntu releases, install broot via APT:

sudo apt update
sudo apt install broot

Installing on Arch Linux and Manjaro

Arch Linux provides broot in the official extra repository:

sudo pacman -S broot

Installing via Cargo

If you prefer building the latest upstream release using Cargo:

cargo install --locked broot

Initialising Shell Integration for Directory Jumping

When you launch broot for the first time, it asks whether you want to install its shell function:

broot

broot prompts: “Do you want me to install the br shell function in your configuration files?” Press y and hit Enter.

This adds the lightweight br wrapper to your ~/.bashrc or ~/.zshrc. Reload your shell configuration:

source ~/.bashrc
# Or for Zsh:
source ~/.zshrc

The br command wrapper is essential: because standard Linux processes cannot modify the working directory of their parent shell, running br allows broot to change your shell’s active working directory upon exiting.

Navigating and Searching Directories with broot

Launch the interactive interface using the shell wrapper:

br

Your screen transforms into a clean, balanced tree representation of your current directory.

Real-Time Fuzzy Searching

To locate a file or directory anywhere in the tree, simply start typing without pressing any special shortcut keys. As you type:

  • Matching files and parent folders are highlighted in vibrant green or blue.
  • Irrelevant subdirectories collapse automatically to make room for matching paths.
  • Press the Down and Up arrow keys (or Ctrl + N / Ctrl + P) to navigate between search matches.

Jumping to a Selected Directory

Select any folder in the tree and press Alt + Enter. broot closes immediately, and your terminal shell prompt is transported directly into that selected folder.

Viewing File Sizes and Disk Usage

broot includes a built-in disk usage analysis mode that turns it into a high-speed terminal alternative to utilities like ncdu:

  1. Launch br inside your target directory.
  2. Type :s and press Enter (or launch with br -s).
  3. broot scans subdirectories and displays exact file sizes alongside proportional percentage visual bars.

This allows you to quickly pinpoint which log folders, database files, or cache directories are consuming server disk space.

Displaying Hidden Files and Ignoring gitignore

By default, broot hides files beginning with a dot (hidden files) and entries specified in .gitignore. You can toggle these filters dynamically inside the interface:

Command / Verb Shortcut Key Effect
:toggle_hidden Alt + H Toggles visibility of dotfiles and hidden system folders.
:toggle_git_ignore Alt + I Shows files normally excluded by your Git repository rules.
:toggle_perm Alt + P Displays Unix file permissions, user ownership, and groups.
:toggle_counts :c Shows the total number of files contained within each directory.

Inline File Previews and Editing

broot can also preview document contents without launching external text editors:

  • Select any text file and press Right Arrow. A secondary preview pane opens on the right, displaying the file’s text with syntax highlighting.
  • To open the selected file in your system’s default editor (such as Neovim or Nano), press Enter or type :e.

By replacing bloated directory dumps with an intelligent, window-aware tree navigation interface, broot makes exploring large Linux filesystems effortless.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.