Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 980 Bytes

File metadata and controls

63 lines (44 loc) · 980 Bytes

grep (ripgrep) Quick Reference

The grep alias uses rg (ripgrep) for fast searching.

Basic Usage

# Search in file
grep "text" file.txt

# Case-insensitive
grep -i "error" app.log

# Search all files (recursive by default)
grep "TODO" .

# With line numbers
grep -n "function" script.js

# Count matches
grep -c "import" *.js

Common Patterns

# Show context (3 lines before/after)
grep -C 3 "error" app.log

# Invert match (exclude)
grep -v "debug" app.log

# List files with matches
grep -l "database" *.config

# Whole word match
grep -w "log" app.js

# Multiple patterns
grep "error|warning" app.log

Important: Search Everything

# rg ignores .gitignore by default
# To search like Linux grep:
grep --hidden --no-ignore "text" .

Pipe Usage

cat app.log | grep "error"
Get-Process | grep "chrome"

File Type Filtering

grep -t js "function" .
grep -t py "def " .