Skip to content
BENIBIX Learn

Grep Tool

AI⌨️ Claude CodeBuilt-in Tools

Also known as Grep, ripgrep, Search file contents

The tool that searches inside files for a word or pattern.

Think of it like

It is like going through each page to find one word.

Example

Lucy asks where an old function is still used. Claude searches for its name and gets back the six files that call it.

Why it matters

It finds the spots to change in a big project. It does not have to read each file.

Definition

The Grep tool searches inside files for text that matches a pattern. It is built on a fast search program called ripgrep. By default it returns only the names of files that match. It can also return the matching lines, or a count per file. It skips the files your .gitignore hides. Like Glob, it is left out by default on macOS and Linux, where Claude uses grep through Bash.

Example code

bash
claude --allowedTools "Grep"
Turn the Grep tool on for this session.
Grep finds the lines inside the files.

Common mistake

Using it to look in a hidden file. Grep skips the files .gitignore hides, unless Claude gives the file's own path.

Key takeaways

  1. 1
    Searches inside. Lines, not names.
  2. 2
    Three outputs. Files, lines, counts.
  3. 3
    Skips ignored files. Respects .gitignore.

Compare

Learn it properly