Tee is a Linux and Unix command for writting STDIN to STDOUT. It is usefull when you want to redirect STDOUT to a file (or more) and also display it on the screen.

tee -a appends text to files, like >>
tee empties files and adds test, at the beginning, like >
Combined with some commands, tee really does good jobs. I use tee to invoke sudo, inside commands. For example, you can’t sudo echo “something”, so you have to use tee:
This is usefull when adding sources to /etc/apt/sources.list:
$ echo 'some source' | tee -a /etc/apt/sources.list
Or, you can invoke sudo from inside the ViM editor.
Redirect stdin to stdout with > :
$ echo "hello linux geeksters" > linuxg.net
$ cat linuxg.net
hello linux geeksters
Redirect stdin to stdout with tee:
$ echo "hello linux geeksters" | tee linuxg.net
hello linux geeksters
$ cat linuxg.net
hello linux geeksters
This tricks writes “some text” to file1, file2, file3:
$ echo "something" | tee file1 | tee file2 > file3