How do I find text within files in Linux?

Question

How do I find text within files in Linux?

Answer

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

  • See the grep command page for additional information and help with this command.
  • Category
  • :Linux Q&A
  • Companies
  • Click here
  • Solved?
  • Were you able to locate the answer to your question?