Frequently Asked Question

What is ripgrep, and is it better than grep?

ripgrep (the binary is rg) is a modern recursive search tool written in Rust by Andrew Gallant. On any non-trivial source tree it is dramatically faster than GNU grep, often ten or twenty times, because it walks directories in parallel, uses a highly optimised regex engine (Rust's regex crate, based on finite automata rather than backtracking), and skips files listed in .gitignore by default. That last default is exactly what you want for searching code and exactly not what classic grep -r does.

Is it better? For interactive code searching on your own machine, yes, rg "TODO" from the top of a repository finds every TODO in seconds, ignoring node_modules, target/, .git/, and other noise. But ripgrep is not POSIX, not installed everywhere, and not part of any standard. Shell scripts aimed at portability still need plain grep. The right policy is: ripgrep for human use, grep for scripts.

Video

Further reading and video