LinuxCommandLibrary

broot

Navigate and explore directory trees

TLDR

Install or reinstall the br shell function

$ broot --install
copy

SYNOPSIS

broot [OPTIONS] [PATH]

PARAMETERS

[PATH]
    The starting directory for broot. If not specified, it defaults to the current working directory.

-h, --help
    Displays the help message and exits.

-V, --version
    Prints the version information and exits.

-s, --show-sizes, --sizes
    Displays the size of files and the sum of contents for directories. Sizes are computed on the fly.

-d, --disk-usage
    Calculates and displays the actual disk usage for directories. This can be slower than --show-sizes but provides more accurate space consumption.

-o, --output <PATH>
    Writes the path of the selected entry to the specified file instead of stdout.

-c, --cmd <CMD>
    Executes a specified internal command after selecting a file or directory, useful for custom workflows.

-f, --file-mode
    Starts broot directly in file mode, showing only files and hiding directories. Ideal for quick file-specific searches.

--only-folders
    Displays only directories in the tree view, hiding all files.

--hidden
    Forces broot to display hidden files and directories (those starting with a dot).

--no-hidden
    Explicitly hides hidden files and directories (often the default behavior unless configured otherwise).

--git-status
    Displays Git status for files and directories within the tree (e.g., modified, untracked).

--permissions
    Displays standard Unix file permissions alongside file names.

--no-sort
    Disables the default sorting of files and directories in the display.

DESCRIPTION

broot is an interactive, terminal-based file manager that combines a tree view with a powerful fuzzy search capability. It is designed for speed and efficiency, allowing users to navigate complex directory structures quickly by typing a few characters to filter and find paths. Unlike traditional file managers, broot doesn't replace your shell but integrates seamlessly with it, often used with a shell alias like br to enable effortless directory changes.

Key features include a live, continuously updated tree display, fuzzy matching for files and directories, convenient file operations (copy, move, delete), the ability to open files with preferred applications, and highly customizable key bindings and internal commands. Written in Rust, it offers excellent performance and a modern, intuitive user experience directly within the command line.

CAVEATS

broot requires a modern terminal emulator that supports true colors and interactive features for optimal functionality. To leverage its full potential, particularly to change your shell's current directory after selection, it's crucial to set up a shell function or alias (e.g., br). Without this integration, broot merely prints the selected path to standard output, not actually changing your shell's working directory. It is designed for interactive use and is not typically suitable for non-interactive scripting.

SHELL INTEGRATION FOR <I>CD</I>

For broot to change your shell's current directory upon selection, you must define a shell function or alias. A common setup involves an alias like br. For Bash or Zsh, you typically add a function to your .bashrc or .zshrc file. This function is designed to call broot with the --out-cmd option. When you exit broot (e.g., by pressing Enter on a directory), broot outputs a command (such as cd /path/to/directory) that the shell function then evaluates. This allows br to launch broot, and upon selection, automatically change your shell's working directory.

CONFIGURATION

broot is highly customizable through a TOML configuration file, usually located at ~/.config/broot/conf.toml. This file allows users to define custom key bindings, add personalized commands, specify file associations for opening different file types, and adjust various display preferences. You can conveniently open and edit this configuration file directly from within the broot interface using the built-in :config command.

INTERNAL COMMANDS

Within the broot interface, you can execute a rich set of internal commands by typing a colon (:) followed by the command name. Examples include :cd (to change the focused directory), :focus (to zoom into a directory), :toggle_hidden (to show or hide dotfiles), :edit (to open the selected file in your preferred editor), :open (to open the selected file with its default application), :delete, and :rename. These commands provide powerful interactive control without requiring you to exit the broot session.

HISTORY

broot was created by Damien 'Canop' Degrandpre and first made its public appearance around 2019. Developed in Rust, it rapidly gained popularity for its innovative approach to terminal file management, uniquely combining fuzzy search capabilities with an interactive, real-time tree display. Its development has been consistently active, with continuous enhancements, new features, and performance improvements, solidifying its position as a favored tool among command-line users.

SEE ALSO

tree(1), ls(1), find(1), fzf(1), ranger(1), nnn(1)

Copied to clipboard