echo 'foo' | tee foo.txt foo cat foo.txt foo
# append cat foo.txt foo echo 'bar' | tee -a foo.txt bar cat foo.txt foo bar