How to search the entire system (Linux) for a particular string?
You should exclude directories like /sys/
, /proc/
and /dev/
from your command:
grep -iR --exclude-dir='/sys' --exclude-dir='/proc' --exclude-dir='/dev' "7z a -p" /
Presumably, that string is in a script file. You might try ack
(aka ack-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.
--[no]ignore-dir=name
--[no]elisp .el
--[no]erlang .erl .hrl
--[no]fortran .f .f77 .f90 .f95 .f03 .for .ftn .fpp
for a few examples
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