Using a File to Save Command Input or Output (Redirection)

Every UNIX command has access to three standardized channels for doing simple input, output, and error messages:

  • I/O channel 0: standard input (stdin)

  • I/O channel 1: standard output (stdout)

  • I/O channel 2: standard error (stderr)

Usually all UNIX commands display their results using the standard output routine supplied by the system. Commands display any error messages using the standard error routine. They get their input via standard input. These standard output routines are written in such a way that it is easy for the shell to redirect the output to a file or pipeline instead of to the screen. Similarly, it is easy to redirect input to come from a file or pipeline instead of the keyboard. ...

Get Practical UNIX 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.