Introduction to the Unix Cluster. Node: Piping

PREV Othercom UP Commands next

Redirection and Piping

Many programs accept input from the keyboard/mouse and provide output to the terminal---also known as standard input and ouput. The shell also allows you to redefine your input and ouput with the symbols > (output to) and < (input from). With general commands, the lack of these symbols incur standard I/O as a default. For even more flexibility, the symbol | (known as a `pipe') allows you to channel the output of one process directly into another process as input.

Some examples of redirection:

        mail karney < message.tmp 
        lpr -r < junk.txt
        ls -l > listing.txt

Some examples of piping:

        dviselect example.dvi 2-3| lpr -d
        cat data.txt | more
        ls -l /test | grep texi

Remember that these symbols can be combined together, and that pipelines can be chained together without limit. All commands in pipes are run simultaneously, in other words, UNIX process creation is cheap!!

PREV Othercom UP Commands next