If you ever need to search for a particular string in a large amount of files (like checking which domain zones are configured to use a particular nameserver), the following command will come in quite handy:

grep --directories=skip -i -l "searched-string" *.extension

–directories=skip skip sub-folders
-i case insensitive search
-l only list filenames where the string was found; without this, the command returns each line in every file where the searched string occurs.

To search recursively (in all sub-folders) of a folder, use this syntax instead:

grep -r -i -l "searched-string" .

Leave a Reply