Skip to content

stdout

Short for standard output, stdout is the default output stream that programs use for their regular results, kept separate from diagnostic messages so the two can be redirected and processed independently.

Standard output is one of three preconnected I/O streams that a process inherits from the process that started it, alongside stdin and stderr, and it occupies file descriptor 1. By default, it points at the controlling terminal, so output appears on the screen, though a shell can rebind it before launch to redirect output to a file or pipe it into another command.

Unlike stderr, stdout is typically line-buffered when connected to an interactive device and fully buffered when connected to a file or pipe, so its output can be delayed until the buffer fills or the stream is flushed.

Modern shells let you point stdout wherever you need it. By default, a command’s output lands on the terminal, but you can redirect that same stream into a file instead:

Language: Shell
$ echo "Hello, stdout"
Hello, stdout

$ # Redirect stdout to a file
$ echo "Hello, stdout" > greeting.txt
$ cat greeting.txt
Hello, stdout

The first echo writes to standard output, which is connected to the terminal, so the text prints right away. The second runs the same command, but the > greeting.txt redirection points stdout at the file, so nothing appears on screen until cat reads it back.

In Python, you write to standard output through sys.stdout, which is where the print() function sends its text by default.

Tutorial

Your Guide to the Python print() Function

Learn how Python's print() function works, avoid common pitfalls, and explore powerful alternatives and hidden features that can improve your code.

basics python

For additional information on related topics, take a look at the following resources:


By Martin Breuss • Updated June 10, 2026 • Reviewed by Leodanis Pozo Ramos