Linux Blog

tee time!

Filed under: Shell Script Sundays — at 3:19 pm on Sunday, June 10, 2012

This weekend was South East Linux Fest, although I’m bummed I couldn’t make it I did learn something new from taking an LPIC level 1 self assessment. What I learned about was the application tee.

The question was something like:

“What command outputs to stdout and also writes to a file”

My answer was “echo” but that was the wrong answer. The correct answer was tee.

I’d seen it before in either Slackware or Debian’s packages list but forgot totally about it. It’s a pretty handy utility to have in your arsenal if you ask me. Usage would be something like this:

date | tee date.txt

this will echo the current date out, and also write it to date.txt. Of course, there are plenty of useful options which can be viewed in the man page which is linked below.

Enjoy! Happy Shell Scripting!