تخطَّ إلى المحتوى

Broot Cheat Sheet

Overview

Broot is a modern, interactive terminal-based file manager and directory navigator written in Rust. It displays directory trees in a compact, navigable format with built-in fuzzy search, file preview, file size analysis, git status integration, and customizable verb system for executing commands on files. Broot excels at quickly finding and navigating to deeply nested files and directories.

Broot’s key innovation is its ability to show an entire directory tree in a compact view that fits within the terminal, using intelligent folding and filtering. As you type, it instantly filters the tree with fuzzy matching. It integrates with your shell to enable cd to directories you find, and supports custom verbs for any file operation.

Installation

# macOS
brew install broot

# Ubuntu/Debian
sudo apt install broot

# Arch Linux
sudo pacman -S broot

# Cargo (Rust)
cargo install --locked broot

# Fedora
sudo dnf install broot

# First run - install shell integration
broot
# When prompted, accept shell function installation
# This creates the `br` shell function for cd integration

Core Navigation

KeyAction
EnterOpen file or focus directory
Alt+EnterOpen file in system default
TabToggle second panel
Ctrl+LeftOpen in left panel
Ctrl+RightOpen in right panel
EscapeBack / Clear filter
Ctrl+QQuit broot
?Show help

Basic Usage

# Launch broot in current directory
br

# Launch in specific directory
br /path/to/dir

# Launch with file sizes
br --sizes

# Launch showing hidden files
br --hidden

# Launch showing git status
br --git-status

# Launch with specific search
br --cmd "pattern"

# Print path instead of cd
broot --out /tmp/path

Searching and Filtering

# Just start typing to fuzzy search
# Example: typing "cfg" matches "config", "configuration", etc.

# Search modes (type prefix):
# (default)   fuzzy search on file/dir names
# /pattern    regex search
# e/pattern   search file extensions
# c/pattern   search file content
# f/pattern   filter to files only
# d/pattern   filter to directories only
PrefixSearch Mode
(none)Fuzzy name search
/Regex name search
c/Content search (grep)
e/Extension search
f/Files only filter
d/Directories only filter

Built-in Verbs

CommandAction
:open or EnterOpen file
:editOpen in editor ($EDITOR)
:cdChange directory (via shell)
:cp <destination>Copy file
:mv <destination>Move/rename file
:rmDelete file
:mkdir <name>Create directory
:chmod <mode>Change permissions
:print_pathPrint file path
:quitExit broot
:toggle_hiddenShow/hide hidden files
:toggle_sizesShow/hide file sizes
:toggle_git_statusShow/hide git status
:sort_by_sizeSort by file size
:sort_by_dateSort by modification date
:sort_by_typeSort by file type
# Use verbs via command mode (type : then command)
# :edit          - open selected file in editor
# :cd            - cd to selected directory
# :cp ~/backup/  - copy selected file
# :mv newname    - rename selected file

Panels

# Tab opens a second panel
# Navigate independently in each panel

# Keyboard shortcuts with panels
# Tab          - toggle/create second panel
# Ctrl+Left   - open in left panel
# Ctrl+Right  - open in right panel

# Copy between panels
# Select file, type :cp {other-panel-directory}

# Preview file in second panel
# Tab to create panel, navigate to file

Git Integration

# Show git status
br --git-status

# Toggle in running broot
:toggle_git_status

# Git status indicators:
# M  modified
# A  added
# D  deleted
# R  renamed
# ?  untracked
# !  ignored

Size Analysis

# Show file/directory sizes
br --sizes

# Sort by size
:sort_by_size

# Show dates
br --dates

# Sort by date
:sort_by_date

Configuration

# ~/.config/broot/conf.hjson or conf.toml

# Default flags
default_flags = "sdgh"
# s = sizes, d = dates, g = git, h = hidden

# Custom verbs
[[verbs]]
invocation = "create {subpath}"
execution = "touch {directory}/{subpath}"

[[verbs]]
invocation = "view"
execution = "less {file}"
leave_broot = false

[[verbs]]
invocation = "code"
execution = "code {file}"
leave_broot = false

[[verbs]]
invocation = "terminal"
execution = "$SHELL"
set_working_dir = true
leave_broot = false

# Editor integration
[[verbs]]
invocation = "edit"
shortcut = "e"
execution = "$EDITOR {file}"
leave_broot = false

# Custom skin (colors)
[skin]
default = "gray(23) none"
tree = "ansi(94) None"
file = "gray(18) None"
directory = "ansi(208) None Bold"
selected_line = "None gray(4)"

Advanced Usage

Custom Verbs

# Open in VS Code
[[verbs]]
invocation = "code"
execution = "code -r {file}"
leave_broot = false

# Open terminal in directory
[[verbs]]
invocation = "term"
execution = "kitty --directory {directory}"
leave_broot = false

# Git operations
[[verbs]]
invocation = "git_add"
execution = "git add {file}"
leave_broot = false

[[verbs]]
invocation = "git_diff"
execution = "git diff {file}"
leave_broot = false

# Bulk operations
[[verbs]]
invocation = "backup"
execution = "cp -r {file} {file}.bak"
auto_exec = false

Shell Function Integration

# The `br` function enables cd integration
# When you select a directory and press Enter,
# your shell actually changes to that directory

# Custom shell function
function bcd() {
  local dir
  dir=$(broot --only-folders --cmd ":print_path" "$@")
  if [ -n "$dir" ]; then
    cd "$dir"
  fi
}

File Preview

# Preview files with syntax highlighting
# Select a file and press Tab to open preview panel
# Or configure a preview verb:
[[verbs]]
invocation = "preview"
execution = "bat --color=always {file}"
leave_broot = false

Troubleshooting

IssueSolution
br: command not foundRun broot first to install shell integration; restart shell
cd not workingUse br (shell function), not broot (binary)
Slow on large directoriesUse search to filter; avoid --sizes on huge trees
Colors wrongCheck terminal color support; configure skin in conf.toml
Hidden files not showingUse --hidden flag or :toggle_hidden
Git status not appearingEnsure git is installed; use --git-status flag
Config not loadingCheck file at ~/.config/broot/conf.hjson or conf.toml
Custom verb not workingCheck verb syntax; test execution command manually