Skip to main content

Ripgrep (rg) Documentation

A comprehensive guide to mastering ripgrep — the fastest code-search tool available. Written in Rust, rg is built for modern codebases: it is parallel, .gitignore-aware, regex-capable, and ergonomic by default.

Mental model: Think of rg as grep with the best defaults already set — no more --exclude-dir=node_modules, no more -rn, no more case complaints.

Curriculum

1. Introduction

2. Core Syntax

3. Smart Defaults

4. Regex & Patterns

5. File & Type Filtering

6. Output & Context

7. Performance & Tuning

8. Real World Workflows

9. Troubleshooting

10. Cheatsheet


Quick start
# Install
cargo install ripgrep # or: brew install ripgrep / apt install ripgrep

# Search any project instantly
rg "TODO" # search cwd, respects .gitignore
rg -t py "def process" # only Python files
rg -l "API_KEY" /etc # just file names
rg -C 3 "panic" logs/ # 3 lines of context