Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsApr 11, 2026·2 min de lectura

ripgrep (rg) — Recursively Search Directories with Regex

ripgrep recursively searches directories for a regex pattern while respecting your gitignore. Written in Rust, ripgrep is the fastest search tool on the market — used inside VS Code, GitHub, and many other dev tools.

Introducción

ripgrep (binary name rg) is a line-oriented search tool that recursively searches directories for a regex pattern while respecting your .gitignore. Written in Rust by Andrew Gallant (BurntSushi), it combines the raw speed of grep with the usability of ag/ack. The search engine inside VS Code, GitHub code search, Helix editor, and many others.

What ripgrep Does

  • Recursive search — walks directory tree
  • Gitignore aware — skips .gitignore, .ignore, global ignore
  • Smart case--smart-case for case-insensitive when all lower
  • File types--type js or --type-add custom
  • Globs-g include/exclude patterns
  • Regex — full Rust regex engine (PCRE2 with -P)
  • Context-A/-B/-C lines 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

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados