Real-World Code Search Recipes

High-value ripgrep recipes for refactors, security scans, framework audits, logs, and docs.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Refactor recipes

Common search patterns used before renames or migrations.

Find debug logging in source code

Locate `console.log` usage across a codebase.

bashANYripgreprefactorjavascript
bash
rg -t ts -t tsx 'console\.log\(' src/

A classic cleanup pass before releases.

Find deprecated API calls

Search for an old method across target languages.

bashANYripgrepmigrationapi
bash
rg -t py -t js '\boldApi\(' .

This helps estimate migration effort before opening a large refactor.

Find a React hook across TSX files

Search only the frontend component surface.

bashANYripgrepreacttsx
bash
rg -t tsx '\buseEffect\b' app/

Restricting the file type keeps results focused and relevant.

Find `SELECT *` usage

Audit SQL anti-patterns in code or migrations.

bashANYripgrepsqlaudit
bash
rg -i 'select\s+\*' .

Helpful for performance and style audits.

Find hard-coded URLs

Search for HTTP(S) URLs in source and config.

bashANYripgrepurlaudit
bash
rg -P 'https?://\S+' .

Great for finding config drift, API endpoints, and test fixtures.

Security and secrets hygiene

Fast scans for obvious risky content before commit or deployment.

Search for AWS access key patterns

Look for common credential shapes.

bashANYripgrepsecuritysecrets
bash
rg -P 'AKIA[0-9A-Z]{16}' .

This is only a first-pass heuristic, not a substitute for dedicated secret scanners.

Find private key headers

Detect committed key material.

bashANYripgrepsecuritykeys
bash
rg 'BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY' .

This scan catches a surprising number of accidental commits.

Find password-like env names

Search environment files for suspicious keys.

bashANYripgrepenvsecret
bash
rg -i 'password|secret|token|api[_-]?key' .env*

Useful in onboarding, audits, and pre-release reviews.

Find JWT-like tokens

Search for three-part dot-separated JWT structures.

bashANYripgrepjwtsecurity
bash
rg -P '[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+' .

This may produce false positives, but it is helpful for quick triage.

Find SSH key references

Inspect code and config for private key usage.

bashANYripgrepsshsecurity
bash
rg -i 'id_rsa|id_ed25519|IdentityFile' .

Useful when standardizing deployment and SSH practices.

Logs, docs, and ops recipes

Practical searches for operations, documentation, and support work.

Search for 5xx errors in logs

Find common server-side error lines.

bashANYripgreplogshttp
bash
rg '\b5\d\d\b|Internal Server Error|Exception' logs/

A quick first pass before deeper log analysis.

Find container image references

Search YAML and Helm files for image tags.

bashANYripgrepkubernetesyaml
bash
rg -t yaml 'image:\s' deploy/ charts/

Helpful during security updates and registry migrations.

Find Terraform resource blocks

Search infrastructure code for a resource type.

bashANYripgrepterraforminfra
bash
rg -t tf '^resource\s+"aws_' infra/

Great for impact analysis before cloud changes.

Find OpenAPI operation IDs

Search specs for operation identifiers.

bashANYripgrepopenapiapi
bash
rg -t yaml -t json '^\s*operationId:' api/

Useful when documenting API coverage or integrating code generators.

Recommended next

No recommendations yet.