34

Hi I wanna keep looking at a log file, but I also don't wanna see irrelevant stuff, I'm only interested in anything with "foobar" in it.

So if I was tailing the file I would do

 tail file | grep "foobar"

Now that I'm adding the -f option, is there a way to somehow only show the stuff that I want? using grep or other technique?

user893730
  • 1,267

1 Answers1

51

You almost wrote the answer, which is :

tail -f file.log | grep "foobar"

That's it.

Ravachol
  • 1,320