How to Install and Use broot in Linux for Interactive Directory Tree Navigation and Fuzzy Searching

Navigating dense folder structures in standard Linux shells often involves switching between the tree command and repeated invocations of cd and ls. While the traditional tree command prints an entire filesystem hierarchy directly into the scrollback buffer, large directories can quickly flood the terminal with thousands of lines, obscuring critical files. broot solves this challenge by introducing an interactive, balanced directory tree overview that intelligently fits any directory hierarchy into the exact dimensions of your current terminal window.

What is broot and Why Should You Use It?

Developed in Rust, broot is an interactive terminal navigator that maintains an overview of large directories by trimming redundant paths and expanding relevant nodes dynamically. Rather than overwhelming you with exhaustive recursive listings, it calculates available terminal height and presents an aesthetically balanced view of the filesystem.

Key advantages of incorporating broot into your daily terminal workflow include:

  • Adaptive Tree Representation: Displays subdirectories proportionally so you never lose high-level context when exploring deep projects.
  • Instant Fuzzy Searching: Type characters anywhere within the active view to filter directory trees in real time.
  • Built-in File Previews: Inspect file contents, text snippets, permissions, and directory sizes without launching an external pager.
  • Integrated Shell Shortcuts: Seamlessly change your working shell directory (br), launch editors, and execute custom shell verbs directly from the interface.
  • Disk Usage Visualisation: Activate whale mode to see exact file size proportions across nested subfolders.

Installing broot Across Linux Distributions

The broot package is packaged in multiple native package managers as well as pre-compiled standalone binaries and Rust crates.

Installing on Ubuntu, Debian, and Linux Mint

On modern Debian and Ubuntu installations, download the official precompiled binary or use package repositories:

# Download the latest precompiled binary
wget https://dystroy.org/broot/download/x86_64-linux/broot -O broot

# Make it executable and place it into system PATH
chmod +x broot
sudo mv broot /usr/local/bin/

Installing on Arch Linux and Manjaro

Arch Linux maintains broot directly within the official community repository:

sudo pacman -S broot

Installing via Cargo (Any Distribution)

If you have Rust and Cargo configured on your workstation, compile and install the latest release directly from crates.io:

cargo install --locked broot

Setting Up the Shell Function (br)

To enable broot to change your current working directory upon exiting, it requires a small shell function alias typically designated as br. Run the initialisation command:

broot --install

The installer automatically detects your active shell (such as Bash, Zsh, or Fish) and inserts a lightweight wrapper into your profile configuration file (e.g., ~/.bashrc or ~/.zshrc). Reload your shell environment to complete setup:

source ~/.bashrc

Interactive Navigation and Core Commands

Once installed, launch the interactive navigator by typing br:

br

Use the following keyboard shortcuts and operational patterns to navigate filesystems effortlessly:

Key Combination Function and Behaviour
Up / Down Arrows or j / k Move selection up and down through the displayed tree hierarchy.
Enter Descend into selected folder or open chosen file in default application.
Alt + Enter Exit broot and change active shell directory to selected path.
Esc Clear current search filter or return to higher directory view.
Tab Switch focus to the preview pane for highlighted files.
? Display built-in comprehensive help and keybindings overlay.
:q Exit broot without changing terminal working directory.

Fuzzy Searching and Filtering Files

To locate a file or directory within deep source trees, start typing letters directly. broot matches patterns fuzzily against folder names and filenames simultaneously:

  • Fuzzy Match: Typing conf highlights configuration files located anywhere within project subtrees.
  • Exact Matching: Prefix search terms with a forward slash, such as /config, to perform strict substring matching.
  • Regex Searching: Prefix with r/ (for example, r/\.json$) to filter using regular expressions.
  • Hidden Files: Type :h or hit Alt + H to toggle display of dotfiles and hidden folders.
  • Git Status: Type :g to filter tree down strictly to files modified, untracked, or staged in Git.

Analysing Disk Space with Whale Mode

When tracking down excessive storage consumption across partitions, activate size-sorting mode by passing the --sizes or -s flag:

br -s

Alternatively, press Alt + S while browsing interactively. broot computes cumulative sizes asynchronously in background threads, displaying proportional progress bars next to directories so you can immediately pinpoint bloated build caches and log repositories.

Customising Verbs and Shortcuts

Configuration files reside in ~/.config/broot/conf.hjson. You can define custom verbs (commands) to streamline developer tasks. For instance, to open highlighted files in Neovim with a custom shortcut:

{
  verbs: [
    {
      invocation: "edit"
      key: "ctrl-e"
      shortcut: "e"
      execution: "nvim {file}"
      leave_broot: false
    }
  ]
}

Mastering broot transforms terminal navigation from repetitive path typing into an intuitive, visually balanced exploration experience that substantially boosts productivity across complex Linux projects.

Get the best tech tips delivered straight to your inbox.

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