Go to the previous, next section.
To tell a command to get its input from another command, type the following:
anothercommand | command
Replace anothercommand with the command that is to generate the output, and replace command with the command that is to get the output. (Note that the `|' symbol is usually found on the far right side of the keyboard.)
A common way to use piping is with the more command, which causes its
input to print at the terminal one screenful at a time. For example,
the following command causes the output of the grep
command to go to
the more command, which prints grep
's output at the terminal one
screenful at a time:
grep counter myprog.c | more
While the grep
command is executing, grep
's standard output feeds into
more's standard input, and more's output goes to its standard output,
which in this case is the terminal.
Go to the previous, next section.