How do I find all files containing specific text on Linux?- with find

I recently had a challenge to look at code. The IP was redirecting to another IP and after testing decided to check the code. This is in Plesk:

# find /var/www/vhosts/domain.com/httpdocs/ -type f -exec grep -H '216.xx.bb.cc' {} \;

And voila! There were 2 files with the hardcoded IP in the config file. This will also work with other strings as well.

Leave a Comment