LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   tee vs > or >> (https://www.linuxquestions.org/questions/linux-general-1/tee-vs-or-476548/)

DotHQ 08-23-2006 07:44 AM

tee vs > or >>
 
tee is new to me. I saw the cmd mentioned in posts here on LQ.org.

I've always used the redirect symbols to write to a file or append to a file > or >> ( double to append).

What does tee add that you all use it instead of redirects (if anything). I realize there is normally more than one way to accomplish the same task. Is this just another occurrence of use whichever you prefer, both will get the job done.

spirit receiver 08-23-2006 08:08 AM

In addition to writing to a file, tee copies the data to STDOUT. So it comes in handy if one wants to create a logfile for later inspection, but also have some immediate feedback in the console.

DotHQ 08-23-2006 08:12 AM

Ahhh. Makes perfect sense. Also helps me understand why it was called Tee. Duh.
Thanks for the reply. :D

Matir 08-23-2006 01:31 PM

tee is also useful if you want to log all the output, but only see output meeting certain criteria:
Code:

./runprogram | tee program.log | grep Error
All output is logged, and messages containing 'Error' are displayed.


All times are GMT -5. The time now is 04:14 PM.