Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Basically, what I would like to do is, instead of just redirecting the out from my terminal command to a file, I would like to have the information also show in the terminal session.

If I use ~$ command > output.log I am no longer able to see the command process in the terminal window and therefore I do not know when the command has finished processing without looking at the output.log file. The commands I run take a few minutes to process and produce quite a bit of output. (hence me wanting to capture that output) Any suggestions?

share|improve this question
add comment

3 Answers 3

up vote 6 down vote accepted

The answer to your question is tee. Just use | tee [output file] instead of > [output file]

Thus, sudo apt-get update > out.log becomes sudo apt-get update | tee out.log.

For more information: LinuxQuestion.org: BASH: How to Redirect Output to File, AND Still Have it on Screen, Linux by Examples: How to redirect output to a file as well as display it out.

share|improve this answer
    
Thank you |tee was exactly what I was looking for. –  Themiddaysun May 22 '12 at 16:35
add comment

command |tee output.log both prints, and captures.

share|improve this answer
    
Thank you, this worked perfectly –  Themiddaysun May 22 '12 at 16:30
add comment

You can use tee.

Example: $ls 2>&1 | tee text.txt

This will print the output of the command into the log file as well in the Terminal.

share|improve this answer
    
Thank you, |tee worked perfectly –  Themiddaysun May 22 '12 at 16:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.