Using tee to create a log

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Wayne Conrad
Date:  
Subject: Using tee to create a log
If the program "foo" writes to stdout, then this runs foo, redirecting its output to logfile:
foo >logfile

If you'd rather append to logfile instead of overwrite it:
foo >>logfile

If foo writes to stderr as well as stdout, some lines won't get captured to the file (you'll see them scrolling by). If that happens and you want to capture those lines too, try this:
foo &>logfile

stdout means "standard output"
stderr means "standard error"

       Wayne Conrad


On Thu, 26 July 2001, Alan Dayley wrote:
> I have a command line utility that spits out data on the screen as it runs.
> I want to capture this data to a "log" file so I can read it later. I
> have been told the tee command will do this for me but I can't seem to get
> the command line correct as the log file is always empty.
>
> The man and info pages are not very helpful to me since I am just learning
> this piping commands stuff.