Redirecting output streams |
|
Normally, when you execute a Unix command, its output goes to your display screen. For example:
yourname@yourcomputer<23>% man date
You can redirect the output stream of any process to somewhere else instead of to your display screen.
To do this, after the name of the command and any
arguments, type the ``greater-than''
symbol (>), and then type a name.
A file will be created by this name, and the output of that command
will be placed in that file.
For example:
yourname@yourcomputer<24>% date >timestamp
This would write the current date and time into a file named
timestamp. We could then display the contents of this
file by typing:
yourname@yourcomputer<25>% cat timestamp
Sat Jan 28 15:03:08 MST 1995
|
John Shipman, john@nmt.edu
Last updated: 1996/01/06 21:54:47 UT URL: http://www.nmt.edu/tcc/help/unix/outredirect.html |
|