A pipe in computing is a one-way channel that carries data from one process to another, in the order it was written. On Linux, macOS and other Unix-like systems it is both a shell operator (the | character) and a kernel feature; on Windows the word covers both shell pipelines and a separate named-pipe mechanism that programs use to talk to each other. The essential idea is the same everywhere: one program writes, another reads, and neither needs to know anything about how the other is built.

Where the Term Comes From

The word is a physical metaphor. A pipe is a tube: you pour something in one end and it comes out the other, and while it is inside you generally cannot reach in and reorder it. Douglas McIlroy, working at Bell Labs, proposed the idea of connecting programs so that the output of one becomes the input of the next. It was implemented in the Unix operating system in the early 1970s, and the vertical bar was chosen as its symbol partly because it looks like a pipe standing on end.

The concept was not entirely new. Older systems used batch job control languages that ran one job after another with data flowing between files. What Unix added was the ability to do this interactively, from a single line, with programs that had no special awareness of each other. That small change is widely credited as one of the reasons the Unix philosophy of small, single-purpose tools spread so far: a tool that reads standard input and writes standard output automatically becomes a building block.

How a Pipe Works

Under the hood, a pipe is a small buffer held in memory by the operating system kernel. It has two ends: a read end and a write end. When you type a command with a vertical bar, the shell creates the pipe before starting the two programs, then wires each program's file descriptors to the correct end. The left-hand program's standard output is pointed at the write end; the right-hand program's standard input is pointed at the read end.

A few properties follow directly from that design:

  • It is unidirectional. Data travels from the left command to the right one. To go back the other way you need a second pipe.
  • Order is preserved. Bytes come out in exactly the order they went in.
  • There is no message structure. A pipe is a stream of bytes, not a series of labelled records. If you need boundaries between messages, you must encode them yourself or use a different mechanism such as sockets.
  • The buffer is finite. If the reader is slow and the buffer fills, the writer blocks until space frees up. This is backpressure, and it is a feature: a fast producer cannot overwhelm a slow consumer.
  • It ends with the writer. When the writing process closes its end, the reader sees end-of-file. Many filters simply keep reading until that happens.

This is also why pipelines feel natural in a terminal. Standard input and standard output are the same interfaces every command-line tool already uses, so the pipe just re-plugs them.

Why Pipes Matter: The Unix Philosophy

The practical benefit is composability. Instead of one enormous program with dozens of flags, you chain small ones. A classic example lists the largest files in a directory tree:

  1. Find every file and print its size and path.
  2. Sort those lines numerically by size.
  3. Take the last few lines, which are the largest.

Written as a pipeline, that reads something like du -a | sort -n | tail -n 10. Each stage is a general tool that knows nothing about the others. Swap one stage and the pipeline does something different. This is the same reason pipes are used inside scripts to automate repetitive work without writing a program in a compiled language.

A less obvious but important consequence is parallelism. The stages of a pipeline run as separate processes, and the kernel schedules them concurrently. While one stage is sorting, another can already be reading input and passing more data along, so the work overlaps.

Types of Pipes

The word covers several related mechanisms, and it is worth knowing which is which:

  • Anonymous pipes. The kernel buffer created by the shell operator | or by a program's pipe call. They exist only while the processes using them are alive and have no name in the filesystem.
  • Named pipes. On Unix-like systems these are FIFOs, special files usually created with mkfifo. On Windows they are a distinct kernel object created through the named-pipe API. Because the pipe has a name, unrelated processes can find it and connect.
  • Pipeline operators in shells. The syntax itself: | for the standard pipe, |& in bash and similar shells to redirect standard error into the next stage, and related constructs such as tee to fork output to a file and to the next stage at once.
  • Pipeline in the broader sense. Software teams borrow the word for any chain of processing stages, such as a build pipeline or a data pipeline. The resemblance is real but the implementation is usually a series of scheduled jobs, not a kernel buffer.

Common Problems and Misconceptions

The most common misconception is that a pipe is a file. It behaves a little like one because you can read from and write to it, but it has no name in the filesystem (unless it is a named pipe), it holds no data once it is closed, and you cannot seek backwards in it. You cannot rewind a pipe.

Other frequent stumbling blocks:

  • Error messages vanish. Only standard output goes down the pipe by default. Standard error still goes to the terminal, which can make a failing early stage look successful. Capture it deliberately if you need to.
  • The last stage gets no filename. Filtering tools work on labels they generate, so commands that would print a filename must be told to, or it is lost.
  • Exit status hides failures. Without extra shell settings, the status of a pipeline is that of the last command. An early stage can fail and the pipeline still exits successfully.
  • Buffering surprises. Output can be buffered when it goes into a pipe rather than a terminal, so a progress indicator may appear late or not at all.
  • Deadlocks with two-way talk. If two processes each try to write a large amount before reading, both can block forever. Two independent pipes, read in the right order, avoid this.

On Windows, the phrase "named pipe" often means inter-process communication for services rather than a shell feature, and its security settings matter: an improperly secured pipe can let unintended local users connect. That is an area to configure deliberately rather than copy blindly.

Pipes Compared With Redirects and Files

A redirect (>) sends output to a file or device; a pipe sends it to another process. Use a pipe when the next step is a program and the intermediate data is not worth keeping. Use a redirect when you want to inspect, keep or reuse the output. Use a temporary file when you need random access, want to run the stages at different times, or need to re-read the data. A named pipe sits between these: it gives you a filesystem name so two programs can meet, but it still passes no data on disk and delivers each byte once.

Frequently Asked Questions

Is "pipe" standard English or slang?

Standard technical English. In computing it has a precise, well-established meaning and appears in official documentation for Unix-like systems and Windows. It is not informal, though individual phrases borrowed from it, such as "piping output into a file", are casual shorthand.

What does the vertical bar do in a command line?

It connects two commands so the output of the one on the left becomes the input of the one on the right. In most shells you can chain several, and the data flows through them in sequence.

Does a pipe store the data anywhere?

Only temporarily, in a small kernel buffer. It does not write to disk, and the data is gone once read. For persistence you need a file or a program such as tee that duplicates the stream.

How do I send error output through a pipe?

By redirecting standard error into standard output first, or by using the combined operator your shell provides. The exact syntax differs between shells, so check your shell's manual rather than assuming.

How is a named pipe different from a regular file?

A regular file stores bytes on disk and can be read again. A named pipe stores nothing; it is a rendezvous point. Reading from it waits for a writer, and each byte is delivered only once.

Can a Windows program and a Linux program share a pipe?

Not directly across machines. Pipes are local to one operating system instance. To move data between different systems you need networking, not a pipe.