3 ms·
I could be wrong, but doesn't each piped command wait for the previous one to finish (not multi-core)?
by reustle 13y ago
I could be wrong, but doesn't each piped command wait for the previous one to finish (not multi-core)?
- buerkle 13y agoNo, try this in a command line: sleep 2 | echo hi
- gnaritas 13y agoNo, a pipe ties the output stream of one command to the input stream of another. That means each line of data travels through the pipe separately allowing all processes to run concurrently.
- gizmo686 13y agoNo, both commands run at the same time. What pipe does is pipe the stdout of one command into the stdin of the other command. Occasionally buffering gives the impression of waiting, as many commands will detect that they are being piped (as opposed to outputting straight to a terminal), and not actually send anything to stdout until either they are finished, or they fill the buffer.