Find an IP address in files

Ever been looking for a config file that contains an incorrect IP address?

If the IP address you’re looking for is 8.8.8.8

Then this command is for you:

find . -type f -exec grep -l 8.8.8.8 {} \;

It’ll find all occurrences of 8.8.8.8 that appear in files in the current directory and folders below it. With that short list you should be able to find where you need to edit.

Written on February 17, 2016