| Crates.io | bhgrep |
| lib.rs | bhgrep |
| version | 0.1.0 |
| created_at | 2025-12-11 16:36:05.200421+00 |
| updated_at | 2025-12-11 16:36:05.200421+00 |
| description | Fuzzy search over your local browser history across all browsers |
| homepage | |
| repository | https://github.com/jondot/bhgrep |
| max_upload_size | |
| id | 1980060 |
| size | 159,583 |
Fuzzy search over your local browser history across all browsers
bhgrep is a blazing-fast command-line tool that lets you search through your browser history across Chrome, Firefox, Safari, and Edge with fuzzy matching, regex support, and an interactive TUI.
git clone https://github.com/jondot/bhgrep.git
cd bhgrep
cargo build --release
The binary will be at target/release/bhgrep. You can add it to your PATH:
sudo cp target/release/bhgrep /usr/local/bin/
cargo install bhgrep
Simply run bhgrep without arguments to enter interactive mode:
bhgrep
Keyboard shortcuts:
Enter: Open selected URL in browsery: Copy URL to clipboardEsc or q: Quit↑/↓: Navigate resultsCtrl+U: Clear searchSearch with a query:
bhgrep --query "rust programming"
# Search and output as JSON
bhgrep -q "rust" --format json
# Get only URLs (perfect for scripting)
bhgrep -q "tutorial" --format url-only
# Open first result in browser
bhgrep -q "github" --open
# Copy first result URL to clipboard
bhgrep -q "stackoverflow" --copy
# Search only Chrome history
bhgrep -q "documentation" --browser chrome
# Use regex for pattern matching
bhgrep --mode regex -q "github\.com/.*/.*" --format url-only
# Find all GitHub repos you've visited
bhgrep -q "github.com" --format url-only | grep -E "github\.com/[^/]+/[^/]+" | sort -u
# Export full history as JSON for analysis
bhgrep -q "" --format json --limit 10000 > history.json
# Search with custom limit
bhgrep -q "documentation" --limit 50
# Use database mode for faster startup (slower queries)
bhgrep -q "search term" --mode db
plain (default): Human-readable format with title, URL, and metadatajson: JSON format perfect for scripting and automationurl-only: Just URLs, one per line# Quick alias for documentation lookup
alias doc='bhgrep -q "$1" --format url-only --open'
# Find all Stack Overflow answers you've visited
bhgrep -q "stackoverflow.com" --format url-only
# Collect resources for a project
bhgrep -q "myproject" --format json | jq '.[] | .url' > resources.txt
# Export sensitive history for analysis
bhgrep -q "token=" --format json --limit 50000 > full_history.json
# Find visits to specific domains
bhgrep --mode regex -q "example\.com" --format json
# Timeline analysis
bhgrep -q "target" --format json | jq -r '.[] | "\(.last_visit) | \(.url)"' | sort
The tool automatically detects available browsers and searches across all of them.
USAGE:
bhgrep [OPTIONS]
OPTIONS:
-q, --query <QUERY> Search query (enables non-interactive mode)
-n, --limit <LIMIT> Limit number of results [default: 10]
--format <FORMAT> Output format: plain, json, or url-only [default: plain]
--open Open first result in browser
--copy Copy first result URL to clipboard
--browser <BROWSER> Filter by browser: chrome, firefox, safari, or edge
--mode <MODE> Search mode: fuzzy, db, or regex [default: fuzzy]
--cache-freshness <SECS> Cache freshness in seconds [default: 600]
-h, --help Print help information
-V, --version Print version information
fuzzy (default): Loads all history to memory, then performs fast fuzzy searchdb: Queries database directly on each search (faster startup, slower queries)regex: Loads all history to memory, then performs regex pattern matching# Debug build
cargo build
# Release build (optimized)
cargo build --release
cargo test
cargo clippy --all-targets --all-features -- -D warnings
cargo fmt --all -- --check
bhgrep/
├── src/
│ ├── browsers/ # Browser-specific history readers
│ │ ├── chrome.rs
│ │ ├── firefox.rs
│ │ ├── safari.rs
│ │ └── edge.rs
│ ├── search.rs # Search algorithms (fuzzy, regex)
│ ├── scoring.rs # Scoring and ranking logic
│ ├── tui.rs # Terminal UI
│ ├── output.rs # Output formatting
│ └── main.rs # CLI entry point
├── .github/
│ └── workflows/
│ └── ci.yml # CI/CD pipeline
└── Cargo.toml
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)# Clone the repository
git clone https://github.com/jondot/bhgrep.git
cd bhgrep
# Run tests
cargo test
# Run with logging
RUST_LOG=debug cargo run -- -q "test"
This project is licensed under the MIT License - see the LICENSE file for details.
fzf and ripgrepbhgrep is optimized for speed:
--mode db for faster startup if you have large history--limit for faster results--browser to search only specific browsersMade with ❤️ by @jondot
If you find bhgrep useful, please consider giving it a ⭐ on GitHub!