will find the string in the current directory and all subdirectories. If you are only interested in the current directory, just do a grep "mystring"
Short explanation about the "/dev/null" thing...
If you leave it out, the command will return all the search strings, but it will not tell you in which file it resides. By default grep will return the filename and the matching line if you search in more than one file at a time, e.g.
grep someting *.txt. So by adding /dev/null, you are actually looking in two files. /dev/null will never contain the pattern that you are looking for, so it is safe.
Careful, this command does not perform the same on all flavours on UNIX.
Also be sure that all the files in the directory are text files.
Also, unless you have endless amounts of time, do not run it against the /dev directory.
You can also modify the find command to look for more specific files, e.g.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.