Stdout

Updated: 11/16/2019 by Computer Hope

Stdout, also known as standard output, is the default file descriptor where a process can write output.

Standard output (illustration)

In Unix-like operating systems, such as Linux, macOS X, and BSD (Berkeley Software Distribution), stdout is defined by the POSIX (portable operating system interface for Unix) standard. Its default file descriptor number is 1.

In the terminal, standard output defaults to the user's screen.

Stdout in the command pipeline

In bash, sequential commands can connect by pipes, represented on the command line by a vertical bar ("|"). Pipeline commands are processed left-to-right, with the standard output (stdout) of each command connecting to the standard input (stdin) of the next.

For instance, in this pipeline of two commands:

fortune | cowsay

The program fortune, which normally prints a random quotation to the user's screen, instead connects its output (stdout) to the input (stdin) of the command on the right:

Standard output of fortune piped to cowsay

For more information about standard output, see redirection in bash.

Bash, Linux, Operating System terms