How do I find text within files in Linux?

Tip: This document is for users looking to finding text within one or more files in Linux and not how to files in Linux.

One of the easiest methods of locating text contained within a file on a computer running Linux is to use the grep command. Below is a basic example of a command used to locate any htm file containing the word "help".

grep "help" *.htm

Additional information

  • See the grep command page for additional information and help with this command.