[prev] [index] [next]

Connecting Commands

The shell provides I/O redirection to allow us to change where processes read from and write to.

< infile connect stdin to the file infile
> outfile connect stdout to the file outfile
>> outfile apppend stdout to the file outfile
2> outfile connect stderr to the file outfile
2>&1 > outfile connect stderr+stdout to outfile

Beware: > truncates file before executing command.

To avoid accidents, use noclobber (-C)