Assembly Line

Instead of grep: ripgrep

Use ripgrep (rg) for searching code and project folders. It searches recursively by default, skips files your .gitignore excludes, and is several times faster than GNU grep on the same work. Keep grep for scripts that must run on any Unix machine.

Old grep gnu.org
Instead ripgrep ★ 70k Unlicense Rust Pushed 9 days ago github.com

Both are for searching files and directories for text that matches a pattern.

Why ripgrep is better

  • It is faster. In ripgrep's own benchmark on the Linux kernel source, rg took 0.063s where GNU grep took 0.674s for the same whitelist search, about 10.69x slower for grep.
  • It stays fast with Unicode. On a 13GB file, ripgrep's benchmark shows 1.042s for rg against 6.577s for GNU grep in a Unicode locale.
  • Its defaults suit code. It recurses into directories, respects .gitignore, and skips hidden and binary files without extra flags.
  • File-type filters are built in, so rg -tpy foo searches only Python files and rg -Tjs foo excludes JavaScript.
  • It runs natively on Windows, macOS and Linux, with binaries published for every release.

When to keep grep

Keep grep in shell scripts, Dockerfiles and CI steps that must run on any Unix system without installing anything, since grep is part of POSIX and ships everywhere. ripgrep's flags are similar but not identical, so a script written for grep is not guaranteed to behave the same under rg.

Switching

Install rg from your package manager and start using it at the prompt. Most everyday flags carry over (-i, -n, -w, -C, -l). The main surprise is the filtering. If a file seems missing from results, it is probably ignored, hidden or binary, and rg -uuu turns all filtering off. Look-around and backreferences need -P to switch to the PCRE2 engine.

Watch out

ripgrep is maintained mainly by one person, Andrew Gallant, though it is mature and widely packaged. Its default regex engine does not support look-around or backreferences. Because it silently skips ignored and hidden files, it can give a false 'not found' if you forget that.

More newer, better command-line tools

Sources

Judged on 2026-11-06. See every command-line tools, or all 66 replacements.