ripgrep (rg) is a line-oriented, recursive search tool written in Rust that searches directories for regex patterns at speeds typically 5–13× faster than GNU grep. It powers the search in Visual Studio Code, Neovim/fzf integrations, and AI coding agents like Claude Code and Cursor. The key mental model: ripgrep's defaults are smart — it automatically respects .gitignore, skips hidden files and binary files, runs multi-threaded, and uses SIMD-accelerated regex matching, meaning you get the right results without extra flags in nearly every codebase scenario.
What This Cheat Sheet Covers
This topic spans 21 focused tables and 129 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Basic Pattern Search
The simplest and most common ripgrep invocations — search a pattern across the current directory or a specific path. By default the pattern is a regex, output is grouped by filename, line numbers are shown, and matches are colored.
| Command | Example | Description |
|---|---|---|
rg 'TODO' | • Recursively searches the current directory for the pattern • equivalent to rg 'TODO' ./. | |
rg 'TODO' src/ | Limits the search to the given directory or file path. | |
rg 'fn write\(' | Default mode treats the pattern as a Rust regex (finite-automata, linear time, Unicode-aware). |