ripgrep
also: rg
ripgrep (rg) is a fast, line-oriented search tool that recursively searches directories for patterns matching a regular expression, similar to grep but significantly faster and with better defaults.
ripgrep is a modern replacement for traditional grep utilities, written in Rust for speed and safety. It searches files and directories recursively for lines matching a given pattern, making it ideal for code searching and log analysis.
Key advantages over grep include automatic respect for .gitignore files (skipping ignored paths by default), faster performance on large codebases, better Unicode support, and more intuitive command-line syntax. For example, rg 'TODO' src/ searches all files under src/ for the word TODO, automatically excluding anything in .gitignore.
Common options include -i for case-insensitive search, -A 3 to show 3 lines after matches, and -l to list only filenames. Unlike grep, ripgrep searches recursively by default without requiring the -r flag.