Search binary files
Treat binary as text (-a) to search process memory
grep -a 'password' /proc/<pid>/mem 2>/dev/null | strings | head -20
- tool
- grep15 commands
More grep commands
-
grep -E '(ERROR|WARN|CRIT)' app.log | tail -50Match lines containing ERROR, WARN, or CRIT
-
grep -ri 'error' /var/log/Search all files under /var/log for 'error' (any case)
-
grep -B3 -A5 'FATAL' app.logPrint 3 lines before and 5 lines after each match
-
grep -c 'POST /api' /var/log/nginx/access.logPrint only the number of matching lines
-
grep -oP '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}' access.log | sort -uExtract IP addresses from log using Perl regex