What ripgrep Does
- Recursive search — walks directory tree
- Gitignore aware — skips .gitignore, .ignore, global ignore
- Smart case —
--smart-casefor case-insensitive when all lower - File types —
--type jsor--type-addcustom - Globs —
-ginclude/exclude patterns - Regex — full Rust regex engine (PCRE2 with
-P) - Context —
-A/-B/-Clines around matches - Output — text, JSON, vimgrep, colored
- Parallelism — multi-threaded by default
Architecture
Single Rust binary. Uses memchr + SIMD for byte-level search, regex crate for patterns. Walks filesystem in parallel (one thread per CPU). Respects .gitignore via the ignore crate.
Self-Hosting
CLI tool, self-contained binary.
Key Features
- Fastest grep alternative (sometimes 10x faster than grep)
- Gitignore/ignore respect
- Parallel search
- JSON output mode
- File type filters
- Unicode aware
- PCRE2 support (with
-P) - Replace mode (
-r) - Integrates with VS Code, Helix, Zed, IntelliJ
Comparison
| Tool | Language | Gitignore | Speed | Regex |
|---|---|---|---|---|
| ripgrep (rg) | Rust | Yes | Fastest | Rust regex + PCRE2 |
| The Silver Searcher (ag) | C | Yes | Fast | PCRE |
| ack | Perl | No (manual) | Slow | Perl regex |
| grep | C | No | OK | POSIX/PCRE |
| git grep | C | Git-aware | Fast | Git regex |
FAQ
Q: How much faster is it than grep? A: Typically 2-10x. The gap is even bigger on large repositories (Linux kernel scale) because ripgrep runs in parallel and skips .gitignore.
Q: Can it search hidden files?
A: They're skipped by default. Enable with -. or --hidden.
Q: Why is it public-domain licensed? A: It's the author BurntSushi's choice. Unlicense is equivalent to waiving copyright — completely free to use.
Sources & Credits
- GitHub: https://github.com/BurntSushi/ripgrep
- License: Unlicense/MIT