rg flags & options
-i, --ignore-case
Search case-insensitively.
rg -i "error" log.txt
-l, --files-with-matches
Print only the file paths that contain matches.
rg -l "TODO" src/
-t, --type
Limit search to files of a specific type.
rg -t py "import requests"
rg -t js "console.log"
-g, --glob
Include or exclude files matching a glob pattern.
rg -g "*.json" "version"
rg -g "!*.min.js" "function"
-C, --context
Show a number of lines before and after each match.
rg -C 3 "panic" src/
--hidden
Search hidden files and directories (dotfiles).
rg --hidden "API_KEY" .
-F, --fixed-strings
Treat the pattern as a literal string, not a regex.
rg -F "file.open()" src/
rg -F "[error]" /var/log/app.log
-w, --word-regexp
Match only whole words.
rg -w "log" src/
--no-ignore
Search files that would normally be skipped by .gitignore rules.
rg --no-ignore "secret" .
rg --no-ignore --hidden "config" .
-c, --count
Show only the count of matches per file.
rg -c "TODO" src/
rg -c -t py "def " src/