Note: You are currently viewing my old web site. There is a new version with most of this content at OJB.NZ. |
More Info: PipesOne 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. Comment on this page: Very Useful • Quite Useful • Useless or: View Results |