->Title Page
->Intro
->Unix
-->Overview
-->File Structure
-->Online Manual
-->Basic Commands
-->Additional Commands
-->Login files
-->Special characters
--->Wildcards
--->Redirection
->Pipes
--->Quote characters
--->Others
-->Miscellaneous Tips
-->Things to try
->Vi editor
->Mirror sites
->Further reading

[ Up ]
[Prev][Home][Next]
[Author]

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

Find this site useful? Want to give something back?

t a y l o r@l i n u x a v e.n e t

© 1993-2000 Christopher C. Taylor