Input/Output redirection
Everybody knows and uses output redirection to get the output of a command to a file.
With > you redirect STDOUT, with 2> you redirect STDERR and with &> you redirect both at the same time.
ls > output.txt
ls 2> error.txt
ls &> output_and_error.txt
But how do you get the output written to the screen AND to a file?
“tee” answers this question. This little program will accept text from STDIN and put in on STDOUT and write it to a file.
This is how you use it:
ls | tee output.txt
July 24th, 2007
[...] tee. Explained here by my colleague raskas. This is nice, but you aren’t able to do manual [...]
August 15th, 2008
[...] a previous post I wrote about output redirection of STDOUT, STDERR and both to a file. Off course you can do the [...]