Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
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
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


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.