Glossary

Pipe

A pipe is a kernel-provided communication channel that connects the standard output of one process to the standard input of another, forming a pipeline. When you type ls | wc -l at the shell, the shell creates a pipe, starts ls with its stdout connected to the pipe's write end, and starts wc -l with its stdin connected to the pipe's read end. The two commands run in parallel, with data flowing between them through kernel buffers.

Pipes are the concrete expression of Unix's do-one-thing-well philosophy. Small tools combined via pipes become a flexible, composable system for text processing and beyond:

ps aux | grep nginx | awk '{print $2}' | xargs kill
journalctl -u sshd | grep -i failed | wc -l
du -sh * | sort -h | tail -20

Besides the anonymous pipes created by the shell, Linux supports named pipes or FIFOs, which exist in the filesystem:

mkfifo myfifo
echo hello > myfifo &
cat < myfifo

Named pipes allow unrelated processes to communicate, and are occasionally useful as lightweight inter-process signals. For high-performance IPC, modern alternatives like Unix-domain sockets, shared memory, or io_uring are usually preferred.

Related terms: stdin, stdout, xargs

Discussed in:

Also defined in: Textbook of Linux