The Linux pipe
Using the Linux pipe to pass information between commands.
On this page
What is the Linux pipe?
The Linux philosophy is that one tool should only perform only one task, in a way that complex workflows may be broken down into smaller tasks that can be resolved by combining multiple tools.
The Linux pipe is represented by the symbol |
and provides a tool connecting
the standard output of one command to the standard input of another command.
Using the Linux pipe
For instance, the standard output of a command command1
can be passed to
the standard input of a command command2
using the sytax command1 | command2
.
The Linux pipe is read from left to right. The standard output of the command on the left is passed to the standard input of the command on the right.
For instance:
cat file1.txt | head -n 5