Prev | Current Page 187 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"

The output is piped to the less command to display
the output. Because the file being displayed is in plain text, you could have substituted any number
of options to work with the text before displaying it. You could sort the contents, change or
delete some of the content, or bring in text from other documents. The key is that, instead of all
those features being in one program, you get results from piping and redirecting input and output
between multiple commands.
Sequential Commands
Sometimes you may want a sequence of commands to run, with one command completing before
the next command begins. You can do this by typing several commands on the same command
line and separating them with semicolons (;):
$ date ; troff -me verylargedocument | lpr ; date
NOTE
54
Linux First Steps Part I
In this example, I was formatting a huge document and wanted to know how long it would take.
The first command (date) showed the date and time before the formatting started. The troff
command formatted the document and then piped the output to the printer. When the formatting
was done, the date and time was printed again (so I knew how long the troff command took to
complete).
Another useful command to add to the end of a long command line is the mail command. You
could add mail -s ???Finished the long command??? chris@example.


Pages:
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199