Search Files Instantly with ripgrep (rg)

Find text across an entire project with rg — grep-speed recursive search that skips .gitignore'd junk and highlights matches.

LinuxsearchtextripgrepLow risk
Run rg "pattern" folder (e.g. rg -n "TODO" .) to recursively search with line numbers and colorized output.

01Command

Command
$ rg -n --hidden -g '!node_modules' "TODO" ~/projects/myapp

02What it does

ripgrep walks directories in parallel, uses Rust's fast regex engine, and automatically skips files listed in .gitignore and binary files — so results are relevant and fast even in huge repos. -n shows line numbers (on by default), -g '*.md' or -t python filters what to search, -i ignores case, and -l lists just filenames. To also search hidden files like .env, add --hidden; use -u repeatedly to disable more of its smart filtering.

03Risk

RiskLow risk
Requirementsripgrep (sudo apt install ripgrep / sudo dnf install ripgrep)
!Warning: rg deliberately skips hidden and ignored files, so "I searched for it and found nothing" can be a false negative — add --hidden or -uu when you really need everything.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • ripgrep (rg) — recursively search with regex
    BurntSushi (GitHub) · vendor-doc · 2026-09-17
    Evidence: Official README: rg recursively searches directories for regex patterns, respects .gitignore, and is faster than grep.
  • rg(1) — Debian manual page
    Debian · community · 2026-09-17
    Evidence: Reference for rg options including -n line numbers, --hidden, -g glob filters, and -t type filters.

Last verified: 2026-09-18 · Category: Developer

06Related solutions