Linux Command Line: Find Files with Matching String

I know this is documented in various places around the web, but I’m tired of hunting it down whenever I need it. Often when working with websites and code, I need to locate any files that contain a particular string. This command searches a folder recursively and prints out the filename of any files that contain the string:

find . | xargs grep 'example string' -sl
Posted in

Leave a Comment

Your email address will not be published. Required fields are marked *