Techknow Study

TEE command in unix

11:53:00 PM vikas 1 Comments Category :

 

The “TEE” command is used to view and store (both at the same time) the output of any other command.Like in windows command prompt we use clip command:-
                                                   "C:\>dir | clip"

First I give the idea about commands who work alone.
The following command displays only output on the screen.


The following command writes the output only to the file, not to the screen.



 
 

Now with the help of “tee” command you can writes the output both to the screen and to the file.



You can also use the tee command to save the output of a command to a file and same time redirect the same output as an input to another command.

The following command will Shows you all files, even files that are hidden (these files begin with a dot.).
and the output is save to a text file “list.txt”.

 

By default tee command overwrites the file. You can put an option with tee command to append the file using “–a” as shown below.

 

You can also write the output to multiple files as shown below.
 
 

RELATED POSTS

1 comments

  1. This is a nice little command/utility and is great for logging things when you have need to prove your work.

    ReplyDelete