Take the 2-minute tour ×

I am using:

user@unknown:~$ sudo command -option > log

to save the results of "command" to the file "log", but I'd like to also get the result on the terminal, is this possible?

I am using ubuntu 10.04 lts.

share|improve this question
add comment

3 Answers

up vote 25 down vote accepted

Use tee.

user@unknown:~$ sudo command -option | tee log
share|improve this answer
cool, thanks... –  fazpas Jul 1 '10 at 18:18
add comment

The command you're looking for is 'tee' which makes a data connection similar to a pipe-tee. it sends data two ways. So

sudo command -option | tee log

would tee the command output to both the file 'log' and to stdout, in this case, your terminal.

share|improve this answer
add comment

You can also use script [ http://linux.die.net/man/1/script ] to capture everything that occurs in your terminal session.


share|improve this answer
add comment

Your Answer


