The grep Command

One of the most commonly used (and known) Unix commands is grep. Learning how to use grep will help you find files that contain a word or pattern. When the grep command is used properly, it can help you search through a file for something specific. For example, what if you wanted to search a file for a unique term?

When we talked about finding data on your Unix system, we narrowed the search down to different variables, such as the size of the file or the creation date. You can also narrow the search with grep.

You will soon learn that grep is one of the most powerful built-in programs in Unix. The program grep is also subdivided into more commands: grep, egrep, and fgrep. These three commands differ in what regular expressions ...

Get SAMS Teach Yourself Unix in 10 Minutes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.