ripgrep (rg) is a line-oriented search tool that recursively searches directories for regex patterns. Faster than grep, ag, and ack, it respects gitignore rules and provides excellent usability.
📑 Table of Contents
Key Features
- Speed: Faster than traditional grep tools
- Smart Defaults: Ignores binary files and hidden dirs
- Gitignore Support: Respects .gitignore patterns
- Unicode: Full Unicode support
- Regex: Powerful pattern matching
Installation
Install ripgrep on Ubuntu:
sudo apt install ripgrep
Usage Examples
Common ripgrep commands:
# Simple search
rg "search term"
# Search specific file types
rg -t py "import"
# Case insensitive
rg -i "error"
# Search with context
rg -C 3 "function"
# Count matches
rg -c "TODO"
# Search hidden files
rg --hidden "config"
Benefits
ripgrep delivers unmatched search speed with developer-friendly defaults. Its performance and smart filtering make code searching effortless.
Was this article helpful?