GARY IS COMING FOR YOU

You shouldn't have done that.

⚙ MALEVELON CREEK
CLICK TO SCAN
SPACE-BAR SERVICE DESK

Bartender

Here to help you explore

Questions and relevant page context are sent to TypeSafe. Questions Bartender cannot answer are saved to improve the site, without your account or IP. Other conversation stays in this tab.

ripgrep Tool Reference


ripgrep (rg) is a fast text search tool that recursively searches directories for a regex pattern. Faster than grep, respects .gitignore by default, and has excellent Unicode support.


Basic Usage

  • rg pattern - Search in current directory
  • rg pattern path/ - Search in directory
  • rg -i pattern - Case-insensitive search
  • rg -w pattern - Whole word match
  • rg -l pattern - List matching files only
  • rg -c pattern - Count matches per file

Search Options

  • -i - Case-insensitive
  • -w - Whole word
  • -v - Invert match
  • -x - Match entire line
  • -F - Fixed string (no regex)
  • -e pattern - Pattern to search
  • -f file - Patterns from file
  • -g pattern - Glob pattern

Output Options

  • -l - List files only
  • -L - List files without matches
  • -c - Count matches per file
  • --count-matches - Count matches (not lines)
  • -n - Show line numbers
  • -N - No line numbers
  • -C N - Context lines (before and after)
  • -A N - Lines after match
  • -B N - Lines before match
  • -H - Show filename (default)
  • -h - No filename
  • --color always - Always colorize
  • --color never - Never colorize
  • --color auto - Colorize when outputting to terminal

File Options

  • -t type - Search only file type
  • -T type - Exclude file type
  • -g pattern - Include glob pattern
  • -g !pattern - Exclude glob pattern
  • --type-list - List all file types
  • --no-ignore - Don't respect ignore files
  • --ignore-case - Case-insensitive matching
  • -u - Unrestricted search (like --no-ignore)
  • -uu - Also search hidden files
  • -uuu - Also search binary files

Common Examples

Basic Search

rg "function"

Search for "function" in current directory.

Case-Insensitive

rg -i "error"

Search case-insensitively.

List Files

rg -l "TODO"

List files containing "TODO".

With Context

rg -C 3 "pattern"

Show 3 lines before and after.

Specific File Type

rg -t py "import"

Search only Python files.

Exclude Type

rg -T js "function"

Search excluding JavaScript files.

Whole Word

rg -w "test"

Match whole word only.

Fixed String

rg -F "*.txt"

Search literal string (no regex).

Count Matches

rg -c "error"

Count matches per file.

Unrestricted

rg -u "pattern"

Ignore .gitignore and other ignore files.


Tips

  • Much faster than grep for large codebases
  • Respects .gitignore by default
  • Use -i for case-insensitive search
  • Use -l to just list files
  • Use -t to filter by file type
  • Use -C for context around matches
  • Excellent Unicode support
  • Great for code searching