tail-grep interested information from stdout

7 Jun 2015

When we run a command, we should pipe it to the tee program:

run_some_command | tee /tmp/some_temp_file

Then, we can open another terminal and run:

tail -f /tmp/some_temp_file | grep --line-buffered "some_pattern"

With the above setting, not only we see STDOUT normally, but we also catch some other important outputs that we are interested in.