Frequently Asked Questions
Can't find an answer here? Check the official FAQ on GitHub or open a Discussion.
General
What is ripgrep?
ripgrep (
rg) is a line-oriented search tool that recursively searches directories for a regex pattern. It was created by Andrew Gallant (BurntSushi) and is written in Rust. Unlike traditional grep, ripgrep is extremely fast, respects .gitignore rules by default, and skips binary files and hidden directories automatically.Is ripgrep faster than grep?
Yes, significantly. On large codebases, ripgrep is typically 5–100x faster than GNU grep, depending on the pattern and the corpus. The speed comes from parallel directory traversal using all CPU cores, SIMD-accelerated literal matching, memory-mapped I/O, and intelligent early skipping of irrelevant files. See the Benchmarks page for detailed numbers.
Can ripgrep replace grep completely?
For interactive developer use, ripgrep can replace grep in almost all scenarios. However,
grep is POSIX-compliant and is available on every Unix system. For portable shell scripts that must run everywhere without extra dependencies, standard grep remains the right choice. Use ripgrep where you control the environment.Is ripgrep open source? What license does it use?
Yes, ripgrep is dual-licensed under the Unlicense and MIT licenses. This means it is free to use, modify, and distribute — including in commercial projects — with essentially no restrictions. The source code is available at github.com/BurntSushi/ripgrep.
Who maintains ripgrep?
ripgrep is primarily maintained by Andrew Gallant (BurntSushi), a software engineer who also writes extensively about Rust, performance, and regex on his blog at burntsushi.net. The project has over 400 contributors on GitHub.
Performance
Why is ripgrep so fast?
ripgrep combines several performance techniques: (1) Parallel search — it uses a thread pool to search many files simultaneously. (2) SIMD — for simple literals, it uses CPU vector instructions to scan multiple bytes at once. (3) Smart filtering — it skips binary files, hidden directories, and git-ignored files before even opening them. (4) Memory-mapped I/O — for large files, it maps them directly into memory rather than reading them chunk by chunk.
How does ripgrep perform on a single large file?
ripgrep uses memory-mapped I/O for large files and SIMD-accelerated search, so it is very fast on single files too. For a 13 GB file, ripgrep can complete a search in a few seconds. Performance depends on your pattern — simple literals are faster than complex regexes.
Does using PCRE2 (-P) make ripgrep slower?
Yes, PCRE2 is generally slower than the default Rust
regex engine because it uses backtracking internally and cannot use SIMD for all patterns. Use -P only when you need features that require it (look-arounds, backreferences). For most searches, the default engine is both faster and safe from catastrophic backtracking.Features
Does ripgrep support .gitignore?
Yes, this is one of ripgrep's defining features. By default it reads and respects
.gitignore, .ignore, and .rgignore files throughout the directory tree. To disable this, use --no-ignore or -u.How do I search hidden files and directories?
Use the
-. flag (short for --hidden). This tells ripgrep to include files and directories whose names begin with a dot. Example: rg -. 'SECRET' .How do I search only specific file types?
Use
-t TYPENAME to include a type, or -T TYPENAME to exclude it. Run rg --type-list to see all 200+ built-in types. You can also define custom types with --type-add. Example: rg -t py 'def ' searches only Python files.Does ripgrep support PCRE2 regex (look-arounds, backreferences)?
Yes. Use the
-P / --pcre2 flag to switch to the PCRE2 engine. This enables look-ahead ((?=...)), look-behind ((?<=...)), and backreferences (\1). The default Rust regex engine intentionally does not support these to avoid catastrophic backtracking. See the Regex Syntax reference.Can ripgrep search inside compressed files?
Yes, use
-z / --search-zip. ripgrep will decompress files on-the-fly before searching. Supported formats: gzip (.gz), bzip2 (.bz2), xz (.xz), LZ4, Brotli, Zstandard (.zst), and LZMA.Can ripgrep replace file contents (not just show matches)?
ripgrep itself does not modify files. The
-r / --replace flag only affects the printed output. To apply replacements to files, pipe ripgrep output through a tool like sed, sd, or use your editor's search-and-replace. Example: rg -l 'old' | xargs sed -i 's/old/new/g'Does ripgrep support multiline matching?
Yes, with
-U / --multiline. In multiline mode, . matches newlines and ^/$ match the start/end of each line. Use --multiline-dotall to make . match newlines even without -U.How do I search non-UTF-8 files?
Use
-E / --encoding ENCODING. ripgrep supports many encodings including latin-1, gbk, euc-jp, shift-jis, and more. UTF-16 is auto-detected via BOM without needing the flag.Troubleshooting
ripgrep isn't finding a file I know exists — why?
Most likely the file is excluded by one of the automatic filters: it might be in
.gitignore, be a hidden file (starts with .), or be a binary file. Try rg -uu 'pattern' to disable all filtering, or rg --files to list which files ripgrep would actually search.How do I fix "cannot print binary file" warnings?
ripgrep detects binary files by looking for NUL bytes and skips them by default. If you know the file is actually text (e.g., a log file with unusual bytes), use
-a / --text to force ripgrep to treat it as text.Colors are not showing in my terminal — how do I enable them?
ripgrep enables colors automatically when writing to a terminal. If you are piping output, colors are disabled. Force colors with
--color always. If colors do not work in your terminal at all, check that your terminal supports ANSI escape codes.On Windows, my paths contain backslashes — do patterns need escaping?
ripgrep accepts both forward slashes and backslashes in paths on Windows. In PowerShell, use single quotes or escape backslashes in patterns. Example:
rg 'pattern' C:/Users/name/project or rg 'pattern' "C:\Users\name\project".