Invert match grep
Remove comment and blank lines from a config file
grep -v '^#' /etc/nginx/nginx.conf | grep -v '^\s*$'
more grep
all 15 commands →
Search only in file type
grep -r --include='*.py' 'import os' /srv/app/
Exclude directories
grep -r --exclude-dir='.git' --exclude-dir='node_modules' 'TODO' .
Print filename and line number
grep -rn 'panic:' /var/log/app/
ripgrep fast search
rg 'TODO|FIXME|HACK' --type py -l
ripgrep with context
rg 'panic' -C3 --glob '*.go'