next up previous contents
Next: Passwords Up: Advanced Topics Previous: I/O Redirection   Contents

Pipes

Suppose a command produces a large amount of output that you want to search through using less. You could produce a file from the command as described above and run less on that file. Or, you could use a pipe. Pipes allow you to redirect one program's output directly into another. For example:

[bbadger@demo01] (1)$ apropos compiler | less

will take the output of apropos and pass it to less. Then, you can use the less program to search through the output. Note that the pipe uses a vertical bar ($\vert$), not a slash (/).

Be aware that this does not create a file because the data is piped directly from one program to another. If you would like to create a file from this data, you will have to use any save features of the program to which you pipe.

Further be aware that not all programs respond the same way to pipes. Some programs behave erratically if data is piped directly to them. Consult man pages for more info.



Michelle Craft 2008-01-23