Text-only Table of Contents (frame/ no frame)
(14) I/O redirection and pipelines Previous Top Next

I/O redirection and pipelines

Any simple command (or shell function, or compound command) may have its input and output redirected using the following operators. This is performed by the shell before the command is run.

Output redirection

> filename
Standard ouput (file descriptor 1) is redirected to the named file. The file is overwritten unless the noclobber option is set. The file is created if it does not exist. More detail
>> filename
Standard ouput is appended to the named file. The file is created if it does not exist.
>| filename
Output redirect, and override the noclobber option, if set.

Input redirection

< filename
Standard input (file descriptor 0) is redirected to the named file. The file must already exist.

Command pipelines

command | command [ | command ...]
Pipe multiple commands together. The standard output of the first command becomes the standard input of the second command. All commands run simultaneously, and data transfer happens via memory buffers. This is one of the most powerful constructs in Unix. Compound commands may also be used with pipes. Pipes play very nicely with multiprocessor systems. More detail

Previous Top Next


ioredirection.src  last modified Mar 26, 2010 Introduction Table of Contents
(frame/no frame)
Printable
(single file)
© Dartmouth College