Showing posts with label tee. Show all posts
Showing posts with label tee. Show all posts

Sunday, October 20, 2013

Duplicate output with Tee

Quite frequently I'll run across a previously unknown gem that keeps my head from getting too big.  It doesn't matter how long you've been doing this type of work, there are things that everyone can learn.  I had a situation the other day where I needed to direct the output from a process to both a file and std out.  Now there are several ways one can accomplish this, whether with named pipes or a bit of creative redirects.  I did a bit of research and found that there is a tool just for such an occasion - tee.

Think of a T-fitting used in plumbing and you get the idea.  By piping output to tee, you can still get the output via std out but also send it to a file.  It's a standard *nix command, so check out the man page for more info.