The pipe — | — is the one idea that makes the Unix command line feel like a language instead of a menu. Each command does one small thing well; the pipe wires them together so the output of one becomes the input of the next, and the combination is a tool nobody had to write.

The idea in one line #

Count the processes of one user, without a special command
$ ps aux | grep ^ana | wc -l

Three commands, none aware of the others, one answer. ps reports everything, grep filters, [wc` counts. Rewrite that in any GUI and it is a feature request; here it is a Tuesday.

Pipelines that earn their keep #

The ranked count, seen across this series in different clothes:

Most-requested URLs from an access log
$ awk '{ print $7 }' access.log | sort | uniq -c | sort -rn | head

A cleanup report that shows before touching anything:

What would be deleted, and how much
$ find . -name "*.tmp" -mtime +30 | tee /tmp/cleanup.txt | wc -l
$ du -ch $(cat /tmp/cleanup.txt) | tail -1

tee splits the stream — a copy to a file, the rest onward — which makes any pipeline auditable.

Why streams beat screens #

A pipeline consumes and produces text, which has three consequences worth internalising:

  • Composability: any command that reads lines can join the chain — jq for JSON, awk for columns, xargs to turn lines back into arguments.
  • Auditability: insert less anywhere to look at intermediate results, remove it, carry on.
  • Scale of attention: you filter before you look, so a million-line log is a non-event.
StageTypical tools
Producecat, curl, ps, find
Filtergrep, head, tail, awk
Transformsed, tr, cut, jq
Actxargs, tee, wc, sort

Every note in this series is secretly about the pipe — from grep to sort and uniq. The whole terminal notes catalogue is on the journal.