Home

Intro to ripgrep


Ripgrep is a command-line tool for searching files that combines the usability of The Silver Searcher with the raw speed of GNU grep. Written in Rust, it is designed to be fast by default and offers a powerful way to search for patterns in your codebase.

Key Features


Basic Usage

The basic syntax for ripgrep is simple:

rg [OPTIONS] PATTERN [PATH]

Simple Search Example

To find the word hello in all files in the current directory:

rg hello

Common Options


Advanced Filtering

Beyond the basics, ripgrep’s true power lies in its extensive filtering options that allow you to precisely control your searches.

Filtering by File Type

ripgrep has a built-in type system that lets you restrict your search to specific file types without having to list file extensions. You can see the full list by running rg --type-list.

Excluding Files and Directories

You can use glob patterns to exclude specific files or directories from your search.

ripgrep automatically respects .gitignore, .ignore, and .rgignore files.


Regular Expressions

ripgrep uses the fast Rust regex engine. Simply enclose the pattern in single quotes to prevent your shell from interpreting special characters.

Tags: Linux, Bash, Ripgrep