Skip to Content
Small, Sharp Software Tools
book

Small, Sharp Software Tools

by Brian P. Hogan
June 2019
Intermediate to advanced
328 pages
7h 27m
English
Pragmatic Bookshelf
Content preview from Small, Sharp Software Tools

Redirecting Input and Output with File Descriptors

When you execute the history command, the program’s output is displayed on the screen. The history command writes its output to standard output, and standard output is mapped to your terminal screen by default.

You’ve already used the > and >> symbols to redirect a program’s output to a file. For example, you can save the contents of your shell history to a file:

 $ ​​history​​ ​​>​​ ​​commands.txt

You also know that the >> symbol appends text to an existing file. For example, you can append today’s date to the file you just created:

 $ ​​date​​ ​​>>​​ ​​commands.txt

Here’s how this concept works. The > and >> symbols redirect content to file descriptors, an abstract way for the OS to ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The VimL Primer

The VimL Primer

Benjamin Klein
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz

Publisher Resources

ISBN: 9781680507003Errata Page