stdin, stdout, sdterr, and Redirection

When a program runs, it automatically has three input/output streams opened for it; one for input, one for output, and one for error messages. Typically, these are attached to the user’s terminal (so they take input from or give output to the command line), but they can be directed elsewhere, such as to or from a file. These three streams are referred to and abbreviated as shown here:

Image

Each of these is assigned a number, shown in the third column.

In the “Redirecting Output and Input” section, you learned how to redirect input and output without needing to know about stdin or stdout. You can also redirect ...

Get Ubuntu Unleashed 2013 Edition: Covering 12.10 and 13.04, Eighth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.