ripgrep search
Blazingly fast recursive search tool
ripgrep (rg) is a line-oriented search tool that recursively searches directories for a regex pattern. It is significantly faster than grep and respects .gitignore rules by default.
Features
- Extremely fast regex search across files
- Respects
.gitignoreand other ignore files - Supports file type filtering
- Automatic encoding detection
- Search and replace with capture groups
Install
brew: brew install ripgrepapt: sudo apt install ripgrepcargo: cargo install ripgrep Commands
| Command | Syntax | Description |
|---|---|---|
rg | rg <pattern> [path] | Search for a regex pattern in files |
rg -t | rg -t <type> <pattern> | Search only in files of a specific type |
rg -l | rg -l <pattern> | List only filenames containing matches |
rg --json | rg --json <pattern> | Output results in JSON format for programmatic use |
Links
Agent Usage Example
Use cases:
- Search codebases for function definitions or references
- Find configuration values across project files
- Locate TODO/FIXME comments for task prioritization
Example workflow:
rg --json 'TODO|FIXME' --type py | jq '.data.lines.text'