Next / Previous / Index / ITC Help System / Publications / Site map / NM Tech homepage

Using pipelines

Tech Computer Center logo

Suppose you want to take the output of some command, call it first, and use that stream as the input of another command called second. This can be done via redirection:

      yourname@yourcomputer<28>% first >temp
      yourname@yourcomputer<29>% second <temp

The output of the first command is redirected to a temporary file named temp, and then the input of the second command is redirected from file temp.

We can do the same thing with a pipeline like this:

      yourname@yourcomputer<30>% first | second
The pipe (|) symbol placed between two commands tells Unix to take the output produced by the commands before the pipe symbol and make that the input of the commands after the pipe symbol.
See also: What is a Unix command?
Previous: Redirecting input streams
Site map
Index: Keyword index to help pages
Help: New Mexico Tech Information Technology and Communications: Help System
ITC Publications
To report a problem: File a ticket
Send mail to the User consultant on duty or call them at 575-835-5437
Home: About New Mexico Tech

John Shipman,
Last updated: 1995/12/04 19:39:34 UT
QR two-dimensional bar code