Favicon of ripgrep

ripgrep

A line-oriented recursive search tool that respects gitignore rules by default, built for fast, Unicode-aware regex search across codebases.

ripgrep (rg) is a line-oriented search tool that recursively searches a directory for a regex pattern. By default it respects .gitignore rules and automatically skips hidden files, directories, and binary files, which is the main thing that separates it from plain grep. It's aimed at developers who search large codebases regularly and want that search to be both fast and to automatically stay out of build artifacts, dependencies, and other files you almost never actually want to search.

Key features

  • Automatic filtering: skips files ignored by .gitignore, .ignore, or .rgignore, along with hidden files and binary files, by default; disable all of it at once with rg -uuu.
  • File type filtering: limit or exclude searches by file type, for example rg -tpy foo to search only Python files or rg -Tjs foo to exclude JavaScript, with support for teaching ripgrep new custom file types.
  • Full Unicode support with no speed penalty: unlike GNU grep, ripgrep stays fast while Unicode support is always on, built on Rust's regex engine which builds UTF-8 decoding directly into its finite automaton.
  • Optional PCRE2 engine: switch regex engines to PCRE2 for look-around and backreferences not supported by ripgrep's default engine, via -P/--pcre2 or --auto-hybrid-regex.
  • Multiline and replacement support: search across multiple lines and rewrite output based on what matched, in addition to standard single-line search.
  • Search inside compressed files: with -z/--search-zip, search files compressed in brotli, bzip2, gzip, lz4, lzma, xz, or zstandard without decompressing them manually first.
  • Encoding support: search files in encodings other than UTF-8, including UTF-16, latin-1, GBK, EUC-JP, and Shift_JIS, with some automatic UTF-16 detection.
  • Configuration file support: persistent default options via a configuration file, so you don't have to repeat common flags on every invocation.
  • JSON output for tooling: the --json output format is designed to be consumed by other tools, such as the delta syntax-highlighting pager, which can pipe ripgrep's JSON straight into a readable diff-style view.

Ideal use cases

ripgrep is a strong default for searching inside any git-tracked codebase, since gitignore-aware filtering means you get relevant results without manually excluding node_modules, build output, or .git internals every time. It's also useful for large one-off searches (log files, extracted archives, big text corpora) where raw grep speed matters and Unicode correctness can't be sacrificed for it. Its file-type filtering makes it convenient for narrowing a search to just the language you're working in without writing a complex glob pattern by hand.

It's not the right tool if you need strict POSIX conformance or ubiquity across every possible environment; the README is direct that plain grep remains the better choice for that, since ripgrep doesn't conform to any standard like POSIX despite working on Windows, macOS, and Linux. It's also purely a search tool, not a file indexer that runs in the background, so every invocation walks the filesystem fresh rather than querying a prebuilt index.

Anyone wanting to try it before installing can use an unofficial online playground and interactive tutorial linked from the README, and a documented feature-comparison table (maintained by the author of ack) lays out how ripgrep stacks up against ack, ag, git-grep, and GNU grep feature by feature.

Installation

Precompiled binaries for Windows, macOS, and Linux are available on the releases page.

Via Homebrew (macOS/Linux):

brew install ripgrep

Via common Linux package managers:

sudo apt-get install ripgrep     # Debian/Ubuntu
sudo dnf install ripgrep         # Fedora
sudo pacman -S ripgrep           # Arch Linux

Via Windows package managers:

winget install BurntSushi.ripgrep.MSVC
scoop install ripgrep
choco install ripgrep

Via Cargo, if you have a Rust toolchain (minimum supported version 1.85.0):

cargo install ripgrep

To build from source directly:

git clone https://github.com/BurntSushi/ripgrep
cd ripgrep
cargo build --release

Optional PCRE2 support can be compiled in with the pcre2 feature flag:

cargo build --release --features 'pcre2'

The binary name after installation is rg.

Categories:

Frequently asked questions

Share:

Stars
66K
Forks
2.6K
Last commit
3 hours ago
Repository age
10 years
License
Unlicense
Self-hosted
No
Activity score
86/100
View Repository
Built with:

Similar to ripgrep

Favicon

 

  
  
Favicon

 

  
  
Favicon