How to use tee with stdout and stderr? - The UNIX and Linux Forums
for showing and redirecting at the same time, you can use: ./program 2>&1 | tee program.log in the file program.log, the statement stores stdout and stderr as well.