standard output and standard error

The two channels a program writes normal output (stdout) and error messages (stderr) to, plus stdin for input.

In more detail

Every program starts with three streams: standard input (stdin) to read from, standard output (stdout) for normal results and standard error (stderr) for error messages. In a terminal all three are connected to your screen and keyboard, but the shell can connect them to files with redirection or to other programs with a pipe. Keeping errors on a separate stream means they stay visible even when output is saved to a file.

Examples

A registered command result holds what the command printed, so a later task can read id_result.stdout.
Factor XI of the twelve-factor app: each process writes its log events, unbuffered, to standard output, and the platform collects and routes them.
git commit -a -F - reads the commit message from standard input.
echo "commit-msg: subject is not a conventional commit" >&2 writes to standard error.
fmt.Fprintln(os.Stderr, "probe: host unreachable")
java -version prints to standard error, not standard output.
rpk topic produce reads each line of standard input as one record.
Every process starts with these three streams as file descriptors 0 (stdin), 1 (stdout) and 2 (stderr). By default they are connected to your terminal, and the shell can redirect them to files or other programs. A process that must keep running after you log out needs its output redirected somewhere, because the terminal it was attached to goes away.
The course logger writes one JSON record per line to stdout.
In this course: print writes to standard output. pytest captures both streams for each test and shows them in the failure report, unless you run with -s.

Related terms

Taught in

References

Certification courses