Search recursively for text with line numbers
Build a paste-ready command, then review its compatibility and effects before running it.
rg -n <search-text> .Complete required fields to copy the generated command.
read-onlyno known side effects Compatibility
Linux + macOSVerified for Linux, macOS using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-19
Requirementsrgrg must be installed and available on PATH.
Version supportrg Current supported releasesVerified for linux, macos using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signals./config/app.yml:18:request_timeout: 30Representative successful output; values vary with the selected target and system state.
Known errorsrg: command not foundrg is missing or is not available on PATH.
Verifyrg -n {{needle}} {{path}}The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01rgRipgrepSearches file contents recursively and respects ignore files by default.
02-nLine numbersPrefixes every match with its source line number.
03"needle"Search patternReplace this text with the phrase or regular expression to find.
04.Search pathStarts the search in the current directory.
Example input
rg -n "timeout" .
Example output
./config/app.yml:18:request_timeout: 30
./src/client.ts:42:throw new Error("Request timeout")
Illustrative output — exact values vary by system and data.
Official sources