Chapter 15. Need Redirection?

You’re probably already familiar with standard transmissions, Standard Oil, and standard rates. For the moment, forget all about those standards and focus on these: STDIN, STDOUT, and STDERR.

You may recall from Chapter 5, “Everything’s a File” that by default the STDIN (standard input) stream comes from your keyboard, and STDOUT (standard output) goes to your terminal. That’s where the process reading STDIN and writing STDOUT normally puts STDERR (standard error) as well. Let’s take a look at a few ways we can redirect those standard streams.

Less Than: <

The left angle bracket, or “less than” symbol, shown above is used to tell a process to look elsewhere for its standard input. Where should it look? To the file name ...

Get CLI for Noobies: A Primer on the Linux Command Line 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.