tee
From NetBSD Wiki
With tee(1), you can split a pipestream in two. It allows you to view information on stdout while at the same time having a copy written to a file.
Trivial example:
$ cat foo | tee bar These are the contents of foo. If you don't like it, damn you! $ diff -s foo bar Files foo and bar are identical
This command is very useful when debugging (long) pipeline sequences, it allows you to print the output of a command as it is written into the pipe.
By default, tee(1) overwrites the file. Use the -a flag to append to the file instead.
