Search only one file type
Limit a recursive search to .py files
grep -r --include='*.py' 'import os' /srv/app/
More grep commands
-
grep -r --exclude-dir='.git' --exclude-dir='node_modules' 'TODO' .Search recursively but skip .git and node_modules
-
grep -rn 'panic:' /var/log/app/Show the file and line number for each match
-
rg 'TODO|FIXME|HACK' --type py -lList Python files that contain TODO, FIXME or HACK
-
rg 'panic' -C3 --glob '*.go'Show 3 lines of context around matches in Go files
-
rg 'secret_key' --hidden --no-ignoreAlso search hidden files and files ignored by .gitignore