stdout Notes
redirect the output (AKA stdout) to a file:
SomeCommand > SomeFile.txt
Or if you want to append data:
SomeCommand » SomeFile.txt
If you want stderr as well use this:
SomeCommand &> SomeFile.txt
or this to append:
SomeCommand &» SomeFile.txt
if you want to have both stderr and output displayed on the console and in a file use this:
SomeCommand 2>&1 | tee SomeFile.txt
sudo apt upgrade >&1 | tee upgrade_log.log
^^
(If you want the output only, drop the 2 above)
This post is licensed under CC BY 4.0 by the author.