December 1999
Beginner
528 pages
11h 10m
English
The tee command acts the way it is pronounced. It takes the input and sends one copy to the standard output and another copy to a file. If you want to see your output and save it to a file at the same time, then this is the command for you.
The general format is:
tee -a files
where, ‘-a’ means append all output to a file.
Tee comes in handy when you are running commands or scripts and you want to keep a log of the output.
Let’s look at an example. Using the who command, the output is sent to the screen and a copy is sent to a file called who.out.
$ who | tee who.out louise pts/1 May 20 12:58 (193.132.90.9) matthew pts/0 May 20 10:18 (193.132.90.1) cat who.out louise pts/1 May 20 12:58 (193.132.90.9) matthew pts/0 May 20 10:18 (193.132.90.1) ...Read now
Unlock full access