Glossary

stdin (standard input)

Stream 0 — where a program reads its input from.

Standard input is the stream a program reads from, numbered 0. By default it is your keyboard, but the shell can rewire it before the program starts: from a file with <, or from another program's output through a pipe.

Commands designed for pipelines read stdin when given no filename — which is why grep pattern works after a pipe, and why sort, wc and awk slot into pipelines so naturally.

See it in practice

$ sort < names.txt

Feeds a file into a command’s standard input. Most filters also read stdin when given no filename, which is what makes pipes work.

Where you'll meet it

stdout (standard output)

Stream 1 — where a program writes its normal results.

Pipe (|)

Connects one program's output to the next one's input.

Pipes & redirection

In-depth guide

Learn these concepts by typing them: the interactive course builds them up lesson by lesson in a real simulated shell.