If you're running a program and you want to send its output to a file - but
you want to see the output on your screen, too, so you can stop the
program if something goes wrong - you can use
program reads its standard input and writes it to one or more
(The CD-ROM has the GNU version.)
A pipe may
the output of a program, collecting it in chunks
and spitting it out every so often.
If the program's output comes slowly and feeds
through a pipe,
there might be long delays before you see any output.
In that case, it's better to use
to redirect output to a file,
put the program into the background, and watch the output with
Or use a program like
for saving results in the middle of a long pipeline of commands.
That's especially good for debugging.
For example, you could type:
| tee prog.out | sed -f sedscr | tee sed.out |
to save the output of
in the file
and also pipe
it to the
's output in
also pipe it...
If you want to add to a file that already exists, use the