tee
#linux #command
A linux command for splitting output to file and the console at the same time, like streaming it through a letter T.
Basic usage:
ls | tee tmp.txt
This is going to run ls and output the result to console but also copy it into tmp.txt.
There are also flags or options to tee that might be useful, such as making it append rather than overwrite:
python3 random.py | tee -a tmp.txt # append instead of overwrite