The pipe command lets you take the output from one command and use it as input to another command. The pipe is represented by the bar (|) sign. The general format is:
command1 | command2
where the ‘|’ is the pipe.
In the following example, a file listing is carried out on the current directory, and all files are displayed or would be if the pipe was not there. The shell sees the pipe, takes all the files and gives them to the command on the right of the pipe, so that in essence the pipe is doing exactly what its name implies: piping the information from one side to the other. In this case grep then searches through this output looking for the pattern quarter1.doc:
$ ls | grep quarter1.doc quarter1.doc
Let’s see that example again ...