Tail a log file for specific strings

I needed to tail a logfile in realtome for specific strings to understand why mpd was failing to update all of my music. To do this I tail the log file as follows:

tail -f filetofollow

This follows the output of the log file, however this includes everything; including a lot of unwanted noise.

Grep can be used to search through text for specific strings, filtering out the noise.

Tail can be piped into grep, however grep will only run once tail has completed. This means on a continual log file you cannot see grep results as the log is created, only post the log being created and tail completing.


tail -f filetofollow | grep --line-buffered stringtofind

This follows the log file as it is created, only printing lines containing the strings required.


  1. Users who have a Google account on an Android smartphone are looking for ways to effortlessly remove their Google account from their Android devices. Now, if you're interested in learning how to delete your Google account from your Android smartphone, keep reading.
    Google Bellen


Note: only a member of this blog may post a comment.