Skip to content
Advertisement

linux – How do I capture all of my compiler’s output to a file as well as need to display output

The below program redirects all my output to log file. I need to display all the output along with log file. How can this be achieved?

$ gcc test.c
$ ./a.out > log.txt
$

Advertisement

Answer

You could use tee:

$ ./a.out | tee log.txt
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement