grep "string I'm looking for" file
in windows find can be used but its a pain, better to download a port of grep.
-C
Hi all,
How do i find a file which has a particular string? I have to find the string scanning entire system.
grep "string I'm looking for" file
in windows find can be used but its a pain, better to download a port of grep.
-C
$ man grep
$ man find
# find / -type f -print0 | xargs -0 grep -I -H "string to find"
will give you all the strings and where they were found.
This searches the entire file system starting from the root, but skips binary files..
If you want to search only part of the file system, replace the first argument to find (/) with the directory from which to start.
# find / -type f -print0 | xargs -0 grep -I -l "string to find"
will give you only where the strings were found.
Note: those arguments to grep are
-I (capital eye) meaning "Ignore binary files"
-l (lower-case ell) meaning "list files where strings were found"
Bookmarks