home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 1.29 When Is a File Not a File? Chapter 1
Next: 1.31 The X Window System

1.30 Redirecting Input and Output

When you run most UNIX programs, their output goes to your terminal. If the programs prompt you for input, they read it from your terminal. You can tell the shell to redirect that output and input from places besides your terminal. For instance, you can save the output of a program in a file, or tell a program to read data from a file instead of the keyboard. The shell handles the redirection of input and output. Article 13.1 explains the syntax you use to control redirection.

A program can also take its input from the output of another program. This kind of redirection is called a pipe ( 1.3 ) . Most UNIX utilities are designed to work with data coming from a pipe; a program that transforms that data in some way is called a filter .

To understand the nitty-gritty details of redirection, you need to understand open files and file descriptors . See article 45.20 .

- JP , TOR

Previous: 1.29 When Is a File Not a File? UNIX Power Tools Next: 1.31 The X Window System
1.29 When Is a File Not a File? Book Index 1.31 The X Window System

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System