Using the Linux grep Command: Grepping a File Without Using cat

227

The grep command is a command that most Linux users learn early on, and many times they learn to use it via pipes (stdin). Because of this some Linux users just assume that grep can only be used with stdin; it’s ok, I was one of those too!

Before I continue with some grep tricks I want to clarify the basic grep usage.

Stop Doing This:

$ cat file.log | grep "something"
 something

Do This More:

$ grep "something" file.log
 something

 

Read more at bc-log