LIVEReading: Search Any Codebase Instantly with ripgrep (rg)Total time: 5 minSteps: 6Worked first time: 95% LIVEReading: Search Any Codebase Instantly with ripgrep (rg)Total time: 5 minSteps: 6Worked first time: 95%
CBW
Search Any Codebase Instantly with ripgrep (rg)
Easygithub.com/BurntSushi/ripgrep2026-06-06

Search Any Codebase Instantly with ripgrep (rg)

ripgrep (rg) searches entire folders for any word or pattern in milliseconds, automatically skipping junk files. It is the fastest replacement for grep and works on Windows, Mac, and Linux.

// Build stats

  • Total time5 min
  • Number of steps6
  • DifficultyEasy
  • Worked first time95%
// Before you start

What you need

  • A terminal / command prompt open
  • Admin or sudo rights to install software
  • A folder of files you want to search
01
Step 1 of 6

Install ripgrep

2 min

ripgrep ships as a pre-built binary for every major OS. Pick the one command that matches your system and run it. You do not need Rust or any compiler.

Terminal · mac
$ # macOS (Homebrew)
$ brew install ripgrep
$
$ # Windows (winget)
$ winget install BurntSushi.ripgrep.MSVC
$
$ # Ubuntu / Debian Linux
$ sudo apt-get install ripgrep
$
$ # Fedora / RHEL Linux
$ sudo dnf install ripgrep
What you should see
No errors. The install finishes and returns you to the prompt.
This might happen

brew or apt-get not found

On macOS install Homebrew first: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". On Windows use the winget line instead.

02
Step 2 of 6

Confirm rg is working

1 min

Run a quick version check to make sure the install succeeded and the rg command is available in your terminal.

Terminal · mac
$ rg --version
What you should see
ripgrep 14.x.x (or similar version number) printed to the terminal.
This might happen

Command not found after install

Close and reopen your terminal, then try again. On Windows, open a new Command Prompt or PowerShell window.

03
Step 3 of 6

Search a folder for a word

1 min

Navigate into any folder you want to search, then run rg followed by the word or phrase you are looking for. ripgrep will scan every file in every subfolder and print each matching line with its file name and line number.

Terminal · mac
$ cd /path/to/your/project
$ rg "TODO"
What you should see
A list of file paths with line numbers and the matching lines highlighted in color. Example: src/main.py:12: # TODO: fix this later src/utils.py:45: # TODO: add error handling
This might happen

No output at all

ripgrep found zero matches, which is a valid result. Try a word you know exists in the folder, like rg "the" to confirm it is working.

04
Step 4 of 6

Search only specific file types

1 min

If your folder has many file types and you only care about, say, Python or JavaScript files, add the -t flag followed by the file type shortname. This keeps results focused and search even faster.

Terminal · mac
$ # Search only Python files
$ rg -tpy "TODO"
$
$ # Search only JavaScript files
$ rg -tjs "TODO"
$
$ # Search only plain text files
$ rg -ttxt "TODO"
What you should see
Only matches from files of the chosen type are shown. Files of other types are silently skipped.
This might happen

Unknown type error

Run rg --type-list to see every supported type name. Use the exact short name from that list.

05
Step 5 of 6

Show lines around each match for context

1 min

Sometimes seeing just the matching line is not enough. The -C flag prints extra lines above and below each match so you understand what surrounds it. Replace 3 with any number of lines you want.

Terminal · mac
$ rg -C 3 "TODO"
What you should see
Each match is shown with 3 lines of context above and below it, separated by dashes between matches.
06
Step 6 of 6

Search all files including hidden and ignored ones

1 min

By default ripgrep skips files listed in .gitignore, hidden files (starting with a dot), and binary files. If you need to search everything with no exceptions, add -uuu (three u's). Use this carefully on large projects — it will be slower.

Terminal · mac
$ rg -uuu "TODO"
What you should see
Results now include hidden files, files in .gitignore, and any other files ripgrep would normally skip.
This might happen

Too many results or terminal freezes on a huge folder

Press Ctrl+C to stop. Add a file type filter like -tpy to narrow the scope, or search a specific subfolder: rg -uuu "TODO" ./src

// Status

cooked. baked. worked.

A fast, color-coded terminal search tool that finds any word or pattern across thousands of files in seconds, respecting your project's .gitignore automatically.

// the honest bit

The honest part

ripgrep is a search tool only — it finds text, it does not edit files. Regex patterns work great for simple searches but complex patterns (like lookaheads) require adding the -P flag for PCRE2 support, which may not be installed in all package-manager versions. ripgrep also does not search inside binary files, zip archives, or PDFs by default.