15

If I wanted to save output to a file from a command like make, I would do:

make > out.txt

However that stops the output from being displayed on the console window, and only saves to a file.

Is there a way to display output from a monitoring process, or a long make command and save it to a file?

John K
  • 514
  • 2
  • 4
  • 13

1 Answers1

31

You can use the tee command to send output to the screen and write the same contents to a file.

make | tee output.txt

If you want to append to the target file (like the >> output.txt redirection) instead of overwriting it, you should add the -a option to tee:

make | tee -a output.txt
Dubu
  • 3,654
  • 18
  • 27
sameh Ammar
  • 1,359
  • 9
  • 7