The tee command writes the text that is passed to it to a file, and then passes it to standard output — generally the output will be piped to another command.
Here is an example of the tee command:
cat access.log | grep 'msnbot' | tee msn_access.log | egrep '(jpg|png|gif)' > msn_image_access.logThe above example does the following:
The result is two new log files — one containing hits from msnbot, and the other containing only msnbot's requests for images on the site.
(NOTE: the above example is not going to be highly precise, but it is simplified so that it doesn't get too confusing.)
You can also use tee to write output to a file and to the screen at the same time like this:
grep 'Googlebot' access.log | tee googlebot_access.log Did you find this post helpful? Leave a comment below, and subscribe to my RSS feed.