Skip to content
BENIBIX Learn

ripgrep (rg)

Development🕸️ Code IntelligenceCode Search

Also known as rg, ripgrep Command, rg Command

A fast command. It looks in every file in a folder for a word or pattern.

Think of it like

It is like a fast finger. It runs down each page in a folder to find one word.

Example

Jack types rg parseDate in his project. It prints the three lines that use it, with file names and line numbers.

Why it matters

It is often the fastest way to find something in code. It runs in under a second on large projects.

Definition

ripgrep is a command-line tool that searches every file in a folder for a word or pattern. You run it as rg. It looks through all the folders inside, too. By default it skips files listed in .gitignore, hidden files and binary files. That makes it fast and its results clean, so many editors and AI tools use it inside.

Example code

console
$ rg parseDate
src/orders.ts
14:  const day = parseDate(order.created);
src/reports.ts
8:  return parseDate(row.date);
One command finds each line with parseDate, and groups the lines by file.
ripgrep is the text search on the left: an exact word, every file.

Common mistake

Not finding a file you know is there. It may be in .gitignore or hidden, so add --hidden or --no-ignore.

Key takeaways

  1. 1
    Searches folders. Every file, every subfolder.
  2. 2
    Skips the junk. Ignored, hidden and binary files.
  3. 3
    Takes patterns. Words or regular expressions.