GNU/Linux Command – TEE

tee – Read from stdin and write to stdout and files
 
Summary:

Tee will copy the stdin to file(s) and also to stdout output. Actually tee is doing double redirection, one to a file and another is to stdout. The following ASCII art will shows “How Tee works”.

StdIn >—+—> StdOut
                  |
                  |
                 V
             File(s)

Examples :
$ tee -- Read from stdin and write into stdout.  $ tee f1 f2 -- Read from stdin and write into stdout, f1 and f2.  $ tee -i myfile -- Same as above. But it will ignore the interrupt signals (Ex: ctrl+C).  $ tee -a myfile -- Read from stdin and write into stdout and append to myfile.  $ who | tee myfile -- Store the output of who to myfile and also write to stdout.  $ ls -1 | tee f1 f2 | wc -l -- Store the ls output in f1, f2 and write the count of all files on stdout.
 
Read : man tee

Advertisements
Tagged with: ,
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: