Stdin is the input stream for a program. Stdin has a file descriptor of 0 on Unix.

Continuing the habit (some flatter it with the term "style") of obsessive word shortening in the Unix world, stdin is a pseudo-acronym for "standard in", or "standard input channel."

The command line, text mode model which Unix has historically used for its programs describes two main "channels" by which the user may interact with an executable: stdin (assumed to be a keyboard, at some point) and stdout (assumed to be a text-based terminal of some kind). A second output channel also exists, called stderr, for delivering error messages "out of band" of normal program output.

This model has propagated across other (originally text mode) operating systems such as MS/DOS/Windows, OS/2, AmigaDOS, BeOS, etc. etc. It is also inherent in many (if not most) programming languages. I think of it as quaint, although that may be a bit premature.

In unix, everything can be conflated with a file, and these channels are no exception; shell operations redirecting stdout to a file, or a file to stdin, are common, typically using the operators "|", "<" and ">". See sh.

Log in or registerto write something here or to contact authors.