The Power of the Pipeline
The pipe operator (|) is the cornerstone of Linux command-line power. It takes the STDOUT of the command on the left and feeds it directly into the STDIN of the command on the right.
General Syntax
command1 | command2 | command3
Practical Example 1: Paging Output
If a command generates too much output, pipe it into less (the pager):
bash $ ls -l /etc | less
Now you can scroll through the long list using the 'less' interface.
Practical Example 2: Counting Files
Use ls to generate a list, and then pipe that list to wc (word count) with the -l (line count) option to count the items.
bash $ ls /bin | wc -l