ripgrep (rg) is significantly faster than grep and respects .gitignore by default. Learn the regex patterns, file type filters, and flags that make it indispensable for codebase search.
ripgrep (rg) is the fastest text search tool available — it respects .gitignore by default and uses SIMD for blistering speed on large codebases.
By the end of this 7 min guide, you'll have a working ripgrep setup and practical ripgrep workflows you can use immediately.
Install ripgrep:
brew install ripgrepripgrep --version or ripgrep -V after installing.ripgrep's power comes from file type filters and regex. Use --type to search specific languages and -g to include/exclude patterns.
Here's a foundational configuration to start with:
# Common ripgrep usage
rg "pattern" --type py
rg "TODO" -g "!node_modules"
rg "function" -l # list files only
rg "pattern" --json # structured outputWith ripgrep configured, these ripgrep-specific workflows will save you time every day:
rg "pattern" basic searchrg -l "pattern" list matching files onlyrg --type py "import" search Python filesrg -g "!*.test.js" "pattern" exclude test filesrg --count "pattern" count matches per fileOnce you're comfortable with ripgrep basics, these advanced techniques will transform your ripgrep workflow:
--replace for find-and-replace preview--json output for integration with fzf or scripts--type-add-zHere are the most common ripgrep issues and how to fix them:
--hidden--no-ignore to override-a to search allCongratulations — you now have a solid ripgrep foundation. Here's where to go next: