I am quite novice with Linux. I have a similar need to this post : pipe and log STDOUT at the same time, but not sure to understand what to do from what is explained :/

I have a command which computes data for several hours and outputs everything in an external log file (log-01) and any error in a dedicated one (log-error) like so:

myCommand > log-01 2>log-error

But I would like to also display on my terminal the different sequential steps of this process by picking up - from the stream or from log-01? -some specific key words and display any associated data of my choice (basically some following numbers or whole line, depending on the step to he checked). Basically what I would do with a grep instruction.

When my log-01 records thousands of lines, my terminal only displays the 20 sequential steps or so.

Thanks in advance for your tips!

1 Answer 1


Use tee:

myCommand 2>log-error | tee log-01
  • Hi Jayhendren, Is tee can allow me to apply some filters of what will be displayed on my terminal (I don't want the whole log, only some key parts of it). Thanks
    – Bispen
    Commented Dec 6, 2016 at 21:07
  • Pipe the output of tee through grep.
    – DopeGhoti
    Commented Dec 6, 2016 at 21:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .