tee

duplicate standard input

tee [-ai] [file]

Copies standard input to standard output unbuffered as well as to file

-a Append the output to the files rather than overwriting them.
-i Ignore sigINT (usually ^c)

Takes the default action for signals for example sigQUIT usualy ^\, except with -i

Examples

Send the echoed message both to stdout and to greetings.txt:
  $ echo "Hello" | tee greetings.txt
  Hello
  $ ls -log greetings.txt 
  -rw-r----- 1 6 Apr  1 16:33 greetings.txt

   echo "report length is:"
# use wc on stdout to count lines in ADDITION to writing the report to report.txt
   report | tee report.txt |wc -l   
   echo "view it?"
   read A
   if [ $A != 'y' ] ; then exit ;fi
   clear
   cat report.txt
   echo "\n\n\n\n\n\n"

   8739
   view it?
   n