Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

On linux/bash I'd like to append stdout of a command to a file, but not redirect it (i.e. I want it to to go to both console and file). Any clues?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

I think "tee" is the right command for this -- unfortunately I don't know the exact syntax. Tee writes its input to stdout and to a file.

share|improve this answer
1  
I looked it up and the basic syntax is: command | tee file.txt –  cmenke Dec 23 '11 at 8:50
    
And a merry christmas to you too! –  Joel Dec 23 '11 at 10:36
3  
If you want to append to the file (instead of overwriting), use command | tee -a file.txt –  Gordon Davisson Dec 23 '11 at 16:12

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.