b.roll
A terminal session recorder with searchable, timestamped output. Think of it as a flight recorder for your shell — record sessions, search through output history, and extract commands as scripts.
Unlike asciinema (video-like playback) or shell history (commands only), broll captures both commands and output with timestamps, stores them in a searchable SQLite database, and provides a TUI for browsing. Commands are captured in real-time via shell hooks (preexec/precmd), so tab completion, arrow keys, and readline editing all work transparently.
Features
- Record terminal sessions via PTY sub-shell — works with zsh and bash
- Name sessions for easy identification and lookup later
- Search across all recorded sessions with prefix-matching full-text search (SQLite FTS5) — live search updates results as you type
- View sessions in a scrollable TUI with timestamped, color-coded output, syntax highlighting, and in-session search (
/) - Mouse support in both TUIs — scroll wheel navigation and click to select/position cursor
- Statistics —
broll statsshows session counts, storage size, and date range - Jump from search results directly into the full session view, scrolled to the match
- Extract commands from any session as a runnable shell script
- Filter sensitive content (passwords, tokens, AWS keys, JWTs) automatically
- Group sessions to correlate multiple terminals working on the same task
- Tag sessions for easy organization and lookup
- Annotate sessions with notes after the fact
- Rename and delete sessions to keep things organized
- Syntax highlighting in view mode — JSON, log levels, URLs, and file:line references are automatically color-coded
- Export/import sessions as portable JSON files for sharing
Installation
From crates.io
From source
Requires Rust 1.85+ (edition 2024).
Usage
Record a session
# Start recording (spawns a sub-shell in the current directory)
# Name the session for easy identification and lookup
# Tag and group sessions for organization
# Combine name, tag, and group
# Start in a specific directory
# Disable sensitive content filtering
# Stop recording (or just `exit` the shell)
When recording, the terminal tab title changes to show broll recording - <name> and a BROLL_SESSION environment variable is set inside the sub-shell. You can optionally add it to your prompt:
# Add to ~/.zshrc or ~/.bashrc
PS1=""
Search output
# Open live search TUI (type to search, results update as you type)
# Pre-fill a query (jumps straight to results)
# Filter by group or terminal
The search TUI has two panels — results list on the left, preview on the right. Run broll search without arguments to enter live search mode where results update as you type with debounced input. Press Tab to switch focus between panels, j/k or arrows to navigate. Press Enter on any result to open the full session in view mode, scrolled to the matching output with it highlighted. Press / or i to edit the search query. Press Esc to return to search results.
View a session
# List all recorded sessions
# List sessions in a group
# View a session by ID prefix or name
The view TUI shows timestamped output with commands highlighted in green and automatic syntax highlighting for output — JSON is color-coded (keys, strings, numbers, bools), log levels are highlighted (ERROR in red, WARN in yellow, INFO in green), and URLs and file:line references stand out. Navigate with j/k, PgUp/PgDn, g/G for top/bottom. Press / to search within the session — matching lines are highlighted, and n/N jumps between matches.
Extract commands
# Print commands to stdout (by ID prefix or name)
# Save as a script
View statistics
Manage sessions
# Add a note to a session
# Rename a session
# Delete a session (prompts for confirmation)
# Delete multiple sessions at once
# Delete without confirmation
Notes are displayed at the top of the view TUI in a distinct colored section.
How it works
broll startspawns your shell inside a PTY (pseudo-terminal) in the current directory- Shell hooks (preexec/precmd) capture commands in real-time with the exact text you typed
- Output is rendered through a virtual terminal (vt100) to preserve column layout and formatting
- Each chunk gets a timestamp and is stored in a local SQLite database with FTS5 indexing
- Sensitive content (env vars with secret-like names, bearer tokens, AWS keys, JWTs, DB connection strings) is redacted before storage
- When the shell exits, the session is finalized
Data is stored locally at:
- macOS:
~/Library/Application Support/broll/broll.db - Linux:
~/.local/share/broll/broll.db
Session groups
When working across multiple terminals on the same task, use groups to correlate them:
# Terminal 1: API server
# Terminal 2: curl testing
# Later: search across both
Sensitive content filtering
Filtering is on by default. The following patterns are redacted:
| Pattern | Example |
|---|---|
| Secret env vars | export API_KEY=sk-abc123 |
| Bearer tokens | Authorization: Bearer eyJ... |
| AWS access keys | AKIAIOSFODNN7EXAMPLE |
| Long secret values | token: aGVsbG8gd29ybGQgdGhpcyBpcyBh... |
| Database URLs | postgres://user:pass@host/db |
| JWTs | eyJhbG...eyJzdW...signature |
| Private key blocks | -----BEGIN PRIVATE KEY----- |
Use --no-filter to disable when you need to capture everything.
Keybindings
View TUI
| Key | Action |
|---|---|
j / Down |
Move cursor down |
k / Up |
Move cursor up |
Ctrl-d / PgDn |
Page down |
Ctrl-u / PgUp |
Page up |
g / Home |
Go to top |
G / End |
Go to bottom |
/ |
Search within session |
n |
Next search match |
N |
Previous search match |
yy |
Yank (copy) current line to clipboard |
Y |
Same as yy |
3yy |
Yank 3 lines starting from cursor |
V |
Enter visual line mode (select range, then y to yank) |
| Mouse scroll | Scroll up/down |
| Mouse click | Position cursor at clicked line |
q / Esc |
Quit (or go back to search) |
Search TUI
| Key | Action |
|---|---|
/ / i |
Edit search query |
Tab |
Switch focus (results / preview) |
j / Down |
Navigate results or scroll preview |
k / Up |
Navigate results or scroll preview |
Enter |
Open full session view at match |
yy |
Yank first line of selected result |
Y |
Yank full chunk of selected result |
| Mouse scroll | Scroll results or preview |
| Mouse click | Select result |
q / Esc |
Quit (or dismiss search input) |
Tech stack
- Rust with edition 2024
- ratatui + crossterm for TUI
- portable-pty for PTY sub-shell
- vt100 for virtual terminal rendering (preserves column layout)
- rusqlite with bundled SQLite + FTS5 for storage and search
- signal-hook for terminal resize handling
License
MIT