I need to find this string:
7z a -p
I've tried:
grep -iR "7z a -p" /
But it seems to hang after a while, with lots of:
grep: /sys/class/vc/vcs5/power/autosuspend_delay_ms: Input/output error
grep: warning: /sys/class/vc/vcsa5/subsystem: recursive directory loop
grep: /sys/class/vc/vcsa5/power/autosuspend_delay_ms: Input/output error
grep: warning: /sys/class/vc/vcs6/subsystem: recursive directory loop
EDIT - However, this seems to just look at static text files. In addition, what about runtime areas, memory and processes? ie the entire system? eg for mysql:
ps aux | grep "mysql -u user -p"
shows :
38164 4292 pts/0 S+ 13:16 0:00 mysql -uodbcuser -px xxxxxxxx
Interestingly ps aux does hide the password with xxxxx. I can try with 7zip but it's quite fast, it has to be running at the same time as you run the ps aux command to "catch it.
You should exclude directories like
/sys/
,/proc/
and/dev/
from your command:Presumably, that string is in a script file. You might try
ack
(akaack-grep
).It will automatically select only script and source files, but you can have it search all files with the
-a
option (in version 1). In version 2, all non-binary files are searched by default.You can specify directories to ignore or for the search to focus on or ignore particular file types.
There are many options that are the same as those of GNU
grep
so they will be familiar.The builtin filtering system is very powerful and configurable. Because of the filtering, searches can be significantly faster than those using
grep
.Installation couldn't be simpler.
documentation
You could throe away errors with
grep -iR "7z a -p" / 2>/dev/null