->Title Page
-->File Structure
-->Online Manual
-->Basic Commands
-->Additional Commands
-->Login files
-->Special characters
--->Quote characters
-->Miscellaneous Tips
-->Things to try
->Vi editor
->Mirror sites
->Further reading

[ Up ]

Unix ---> Pipes

A pipeline is a convenient way to channel the output of one command into the input of another without creating an intermediate file. Let's say we wanted to get an alphabetical listing of the current processes. From a thorough study of the previous section and the man pages for ps and sort, we already know how to do this:

    ps -aux > processes
    sort processes
This works, but it gives us a file (namely processes) which we don't want. The pipe symbol, "|" lets us bypass this intermediate file. The above two commands can be replace with the following:

    ps -aux | sort
It is possible to connect a series of commands by additional pipe symbols. We could pass our previous output through the more paging program to obtain a more pleasing display of the results. This is a accomplished by typing

    ps -aux | sort | more
One important point to recognize is that if a command isn't capable of reading from standard input, it cannot be placed to the right of a pipe symbol.

Site Statistics

t a y l o r@l i n u x b o x.c o m

© 1993-1998 Christopher C. Taylor