Dear friends,
I need to use the grep command on the whole Unix server. What I mean I need to search for ‘String’ in / file system. I try
grep -r 'string' /
Not working. Can you suggest work around?
Dear friends,
I need to use the grep command on the whole Unix server. What I mean I need to search for ‘String’ in / file system. I try
grep -r 'string' /
Not working. Can you suggest work around?
That should work. Another option is combination of find and grep:
sudo find / -type f -exec grep "String-To-Search-here" {} \;
OR
sudo find / -type f -print0 | xargs -0 -I {} grep -l 'Words-To-Search-Here' "{}"
Where find command options are:
xargs options are:
{}
in the initial-arguments with names read from standard input i.e. file name pass to the grep command. See grep command examples:https://www.cyberciti.biz/faq/howto-use-grep-command-in-linux-unix/