# To tee stdout to a file: ls | tee outfile.txt # To tee stdout and append to a file: ls | tee -a outfile.txt