Pipes Versus Redirection
The pipe operator (|) indicates that the output of the command on the left is presented to the command on the right as its stdin. As such, it is related to the redirection operators. However, writing to a pipe, although close in concept, is radically different in action and implementation. The concept is close because both involve taking the stdout from a program and doing something different with it. However, the pipe sends the output to another command for processing, whereas the redirect (>) sends the stdout to a file.
This concept can get confusing if you are not used to it. Just remember that the item to the right of a pipe is a command (usually a filter of some kind), whereas the item to the right of a redirect ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access