I think for the linux command, the pipeline:
$ command1 | command2 | command3
will execute with sequence command1 -> command2 -> command3.
But what about using tee:
$ command1 | tee >(command2) >(command3)
Since that command2
and command3
have the same input, my question is, will command2
and command3
execute in parallel (multithread?) or in sequence 2->3?
Thanks.
command1
will fill (part of) the first pipe's buffer,command2
will be processing it while at the same timecommand1
will continue to run. On multi-core computers you can achieve noticeable speed gain using pipes for CPU-intensive processing.