Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

How can I append a command's output to multiple files?

For example, the command man ls, I need to append its output into three different text files using one command in terminal.

share|improve this question
What you want to do three different files containing the output of man ls? I'm almost sure that nobody will delete that manual page... – Radu Rădeanu May 24 '14 at 17:30
@RaduRădeanu it is just an example – nux May 24 '14 at 17:55
up vote 6 down vote accepted

You can use tee command .

Command :

man ls | tee -a file1 file2 file3 

Result : man ls command's output will be appended into file1 file2 file3

For more info : man tee

Reference : Site

share|improve this answer
If you're using zsh you can do this: echo "Hello World" > {file1,file2,file3} but using tee always works too – Flint May 17 '14 at 2:23
@jobin no i correct my answer , Avinash was right – nux May 18 '14 at 14:27
good that you corrected, +1! – i08in May 18 '14 at 14:28
@nux i revert back my downvotes. – Avinash Raj May 18 '14 at 15:10

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.