tee


Both redirects the output to a file and let's it through to the screen or to a pipe. tee -a would append to the file.


examples/intro/tee.txt
$ ls -l examples/intro/ | tee out | wc
       5      38     257

$ cat out
total 32
-rw-r--r--  1 gabor  staff  336 Apr 11 08:39 pipes.txt
-rw-r--r--  1 gabor  staff   15 Mar  2 15:19 redirection.txt
-rw-r--r--  1 gabor  staff  896 Apr 11 08:19 redirection_bash.txt
-rw-r--r--  1 gabor  staff  238 Apr 11 08:20 redirection_tcsh.txt