16.10 Pipes 243
One answer is to pipe the output to a utility called less. Known as a pager, less, (like more) allows
us to view information one page (or screen) at a time.
We use the vertical bar (|) to pipe the commands (as shown in Figure 16.15).
ls -al /etc | less
Now we can view the contents one screen at a time. To move forward a screen, just press
Space ;to
move back a screen, press
B ;toquit,justpress Q .
Figure 16.15: Piping the output of ls to the less pager
Actually, we’ve already been using pipes, before we even discussed what they were.
In previous references to man pages, we used the following to print out the man page entry:
man ls | col -b | lpr
Here, we’re sending the output of man ls to a filter called col with an option of -b to help format
the text for the printer, then we sent the output of that to the printer using the lpr command.
Comments to this Manuals