ripgrep
Back to Terminal
ripgrepIntermediate10 min

ripgrep Replace and File Type Filters: Advanced Search Beyond grep

Beyond Simple grep

Master ripgrep's file type filters, regex patterns, and replacement mode. Learn to search and replace across thousands of files in seconds.

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 10 min guide, you'll have a working ripgrep setup and practical ripgrep workflows you can use immediately.

Advanced Regex Patterns

Install ripgrep:

brew install ripgrep
Tip: Verify the installation with ripgrep --version or ripgrep -V after installing.

File Type Filtering Mastery

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 output

rg --replace for Refactoring

With ripgrep configured, these ripgrep-specific workflows will save you time every day:

Pro tip: Don't try to adopt everything at once. Start with rg "pattern" basic search and add more as it becomes habit.

JSON & Custom Output Formats

Once you're comfortable with ripgrep basics, these advanced techniques will transform your ripgrep workflow:

Encoding & Binary File Issues

Here are the most common ripgrep issues and how to fix them:

Advanced Search Mastery

Congratulations — you now have a solid ripgrep foundation. Here's where to go next:

← PreviousRaycast Clipboard History and Snippets: Never Type Anything TwiceNext →Starship Cross-Shell Prompt Setup: A Beautiful Prompt for Every Shell