Pipe works like a filter. It is used to connect more than one commands.Symbol for pipe is “ | “.
For example:
$ who | wc
In above example output of left side command ‘who’ to the pipe is added to the input of right side command ‘wc’ of the pipe. In above example both the commands executed simultaneously.
Some important points related to pipes are-
- We can connect any number of commands with pipe.
- In pipe line left side commands output and right side commands input is connected together.
- Not necessary to put space between pipe and commands.
Some of the examples of piping are-
- $ls | wc
- $who | wc
- $ls |sort