Note: You are currently viewing my old web site. There is a new version with most of this content at OJB.NZ.
The new site is being updated, uses modern techniques, has higher quality media, and has a mobile-friendly version.
This old site will stay on-line for a while, but maybe not indefinitely. Please update your bookmarks. Thanks.


[Index] [Menu] [Up] Title[Header]
Terminal Tips

Return to Previous Page


More Info: Pipes

One of the coolest things about the Unix command line is how different commands can work together using a process called "piping". The output from one command can be piped to the input of another. The "|" (vertical bar) symbol is placed after the command which is providing the output, and before the command which is accepting the input.

For example to make the output from a long directory command easier to read you could use the more command. More stops after each page and waits for you to press space. To pipe the directory from the ls command to the more command just use ls | more.

One subtlety about this (which other systems don't have) is that the data is streamed between concurrent processes. In other words the second command processes output from the first command as it appears, the first command is still running at the same time.

Of course, its possible to pipe between more than two programs. For example to list, sort, then more your data use ls | sort -f | more. I used the f option for the sort command so that upper and lower case was sorted together.


Back

[Contact][Server Blog][AntiMS Apple][Served on Mac]

Comment on this page: Very UsefulQuite UsefulUseless or: View Results