Standard streams


In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution.

- Standard streams

138 related topics


Pipeline (Unix)

Mechanism for inter-process communication using message passing.

A pipeline of three program processes run on a text terminal

A pipeline is a set of processes chained together by their standard streams, so that the output text of each process (stdout) is passed directly as input (stdin) to the next one.

System console

Text entry and display device for system administration messages, particularly those from the BIOS or boot loader, the kernel, from the init system and from the system logger.

Knoppix system console showing the boot process
IBM 1620 console, with a typewriter and front panel

Today communication with system consoles is generally done abstractly, via the standard streams (stdin, stdout, and stderr), but there may be system-specific interfaces, for example those used by the system kernel.

Redirection (computing)

The standard streams for input, output, and error
A pipeline of three programs run on a text terminal

In computing, redirection is a form of interprocess communication, and is a function common to most command-line interpreters, including the various Unix shells that can redirect standard streams to user-specified locations.

File descriptor

Unique identifier (handle) for a file or other input/output resource, such as a pipe or network socket.

File descriptors for a single process, file table and inode table. Note that multiple file descriptors can refer to the same file table entry (e.g., as a result of the dup system call) and that multiple file table entries can in turn refer to the same inode (if it has been opened multiple times; the table is still simplified because it represents inodes by file names, even though an inode can have multiple names). File descriptor 3 does not refer to anything in the file table, signifying that it has been closed.

Each Unix process (except perhaps daemons) should have three standard POSIX file descriptors, corresponding to the three standard streams:

Command-line interface

A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text.

Screenshot of a sample Bash session in GNOME Terminal 3, Fedora 15
Screenshot of Windows PowerShell 1.0, running on Windows Vista
A graphical user interface with icons and windows (GEM 1.1 Desktop)
Apple Computer's CommandShell in A/UX 3.0.1
GNU Octave's GUI with command-line interface
Bourne shell interaction on Version 7 Unix
Prompt of a BBC Micro after switch-on or hard reset
An MS-DOS command line, illustrating parsing into command and arguments
The end of the HELP command output from RT-11SJ displayed on a VT100
A Teletype Model 33 ASR teleprinter keyboard with punched tape reader and punch
DEC VT52 terminal

Inter-process communication: Most operating systems support means of inter-process communication (for example, standard streams or named pipes). Command lines from client processes may be redirected to a CLI program by one of these methods.

Java (programming language)

High-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.

Duke, the Java mascot
James Gosling, the creator of Java, in 2008.
The TIOBE programming language popularity index graph from 2002 to 2018. Java was steadily on the top from mid-2015 to early 2020.
Dependency graph of the Java Core classes (created with jdeps and Gephi)

The object is an instance of the class and provides many methods for printing data to standard out, including which also appends a new line to the passed string.

C (programming language)

General-purpose computer programming language.

Dennis Ritchie (right), the inventor of the C programming language, with Ken Thompson
The cover of the book The C Programming Language, first edition, by Brian Kernighan and Dennis Ritchie
"Hello, World!" program by Brian Kernighan (1978)
The C Programming Language
The TIOBE index graph, showing a comparison of the popularity of various programming languages

The program prints "hello, world" to the standard output, which is usually a terminal or screen display.

C shell

Unix shell created by Bill Joy while he was a graduate student at University of California, Berkeley in the late 1970s.

tcsh and sh side-by-side on a Mac OS X desktop
C Shell running on Windows Services for UNIX
64-bit Hamilton C shell on a Windows 7 desktop.

By default, when csh runs a command, the command inherits the csh's stdio file handles for stdin, stdout and stderr, which normally all point to the console window where the C shell is running.

More (command)

Command to view the contents of a text file one screen at a time.

Example output of the  command
The ReactOS command

If no file name is provided, looks for input from standard input.

Sort (Unix)

Standard command line program of Unix and Unix-like operating systems, that prints the lines of its input or concatenation of all files listed in its argument list in sorted order.

The sort command

In Version 5, Thompson invented "-" to represent standard input.