How To Filter Tail Or Any Other Stream With Grep

at in tips

Tail & Grep

The debugging process can be extenuating, usually involves you fiddling around dozens of log files, tracking down some processes, etc…

And for that, any help is welcomed, with this simple trick you can filter the output of the tail command in real time using grep.

This can be particularly useful when you are tracking down some specific action that is being buried by tons of information.

You just need to pipe your tail command with grep using the parameter –line-buffered, like this example here:

tail -f filename.log | grep --line-buffered pattern


See Also