Technical Fixes
RSS icon Email icon Home icon
  • Find Text Inside A File In Linux

    Posted on May 6th, 2010 Matt Parkinson No comments

    Recently I had the need to find all files on a Linux system containing a particular string of text. To do this you can use the following command adjusting it for your specific needs. This command is very useful in cases where websites have been comrpomised to search for a common string that may have been replaced in all of the files on the website.

    find ./ -type f -print0 | xargs -0 grep -l “text to search for”

    The above command will search the current directory for the text “text to search for”. You can change the directory you want to search in by modifying the “./” to the full directory path.