Pipes connect the standard output of one program to the standard input
of another. To do this, just type the two commands with a "|" (vertical
bar) between them.
Let's say that you want to see if your friend, John Smith, is logged
in, but you don't want to look through all the output from "who". You
can take the output from "who" and pipe it through "grep" like this:
["grep" is one in a family of programs that search through a file (or
other input) to find a matching pattern. Type
"man grep" for more details.]
If he is logged in, you will get something like this:
jsmith ttyqo Jan 29 13:12
If he is not, you won't get any output.
Quite often it is useful to pipe the output from a different program to
the "more" program. This will show you the output a page at a time.
Click here to go to the
Or click here to go to the
top of the chapter.