# ripgrep

> Fast line-oriented regex search tool that recursively searches directories with automatic gitignore and binary file filtering

Stars: 69.6k · Language: Rust · Categories: Search

- Repository: https://github.com/BurntSushi/ripgrep
- Page: https://www.trmn.sh/tools/ripgrep

## Overview

ripgrep is a line-oriented search tool that recursively searches directories for regex patterns. It automatically respects gitignore rules and skips hidden files, directories, and binary files by default, though this filtering can be disabled with `rg -uuu`. The tool provides first-class support across Windows, macOS, and Linux platforms.

ripgrep includes comprehensive search capabilities beyond basic pattern matching. It supports file type filtering with commands like `rg -tpy foo` to limit searches to Python files or `rg -Tjs foo` to exclude JavaScript files. The tool can search files in various text encodings (UTF-16, latin-1, GBK, EUC-JP, Shift_JIS) using the `-E/--encoding` flag and can handle compressed files in common formats (brotli, bzip2, gzip, lz4, lzma, xz, zstandard) with the `-z/--search-zip` flag.

The tool offers optional PCRE2 regex engine support via `-P/--pcre2` or `--auto-hybrid-regex` flags, enabling look-around and backreference patterns not supported in the default engine. ripgrep also provides rudimentary replacement capabilities, arbitrary input preprocessing filters for tasks like PDF text extraction, and configuration file support. Performance benchmarks show ripgrep consistently outperforming tools like grep, ag, and ack across various workloads, particularly excelling in Unicode-enabled searches where it maintains speed advantages.

![Screenshot of ripgrep search results](https://media.trmn.sh/cached/46d851ad0c42e12c3bc1222134f28637ab774aa4075e07a10859ecf9b31d995c.png)

## Alternatives

- [fd](https://www.trmn.sh/tools/fd.md): Fast filesystem search tool that replaces find with regex patterns and smart defaults (Rust, 44.9k stars)
- [ast-grep](https://www.trmn.sh/tools/ast-grep.md): CLI for structural code search, lint, and rewriting that matches tree-sitter AST nodes using patterns written as ordinary code. Written in Rust. (Rust, 16.4k stars)
- [rga](https://www.trmn.sh/tools/rga.md): Line-oriented search tool that extends ripgrep to search inside PDFs, archives, documents, and multimedia files (Rust, 9.9k stars)
- [skim](https://www.trmn.sh/tools/skim.md): Fuzzy finder written in Rust with interactive search capabilities and shell integration (Rust, 7.0k stars)
- [television](https://www.trmn.sh/tools/television.md): Fuzzy finder for the terminal that searches files, text, git repositories, and custom data sources in real-time (Rust, 6.4k stars)

## Guides

- [Swap ls, cat, find and grep for eza, bat, fd and ripgrep](https://www.trmn.sh/guides/modern-unix-replacements): Install eza, bat, fd and ripgrep, learn the side-by-side commands and flag differences, and alias them without breaking your scripts.
- [Modern Replacements for grep](https://www.trmn.sh/replace/grep): Compare ripgrep, The Silver Searcher (ag) and rga as replacements for grep: defaults, file-type handling, and what each searches.
- [ripgrep vs The Silver Searcher](https://www.trmn.sh/compare/ripgrep-vs-ag): ripgrep vs The Silver Searcher (ag): Rust vs C, ignore-file handling, regex engines, encodings, editor plugins and when to pick each.

---

Canonical: https://www.trmn.sh/tools/ripgrep
