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 2014 Edition: Covering 13.10 and 14.04,Ninth 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.