wiki/articles/pipe.md

863 B

Pipe

A pipe is an unidirectional IPC mechanism used first in the Unix operating system, used to connect one or multiple processes together (then forming a pipeline). Pipes are a central concept in Unix-like operating systems as it allows the composition of multiple programs results without using temporary files.

In a shell a pipeline is constructed using the | character which by default redirect the process stdout output to the stdin of the process at the right of the pipe.

cmdA | cmdB | cmdC | cmdD

Named pipes

A named pipe also known as a FIFO, is a pipe that is represented as a file on a disk having similar semantics to a regular file.

mkfifo foo              # create named pipe
cat foo &               # will block until something is written to it
echo 'test' > foo       # send data through the pipe