Monday, August 25, 2008

Redirect both stderr and stdout to single file - linux


If you want two files, one for the output(mylog) and one for the errors(mylog.err)

$ ./command 2>mylog.err 1>mylog


And if you want to redirect both stderr and stdout to a single logfile

$ ./command >mylog 2>&1

so "mylog" will contain both stderr and stdout.

1 comment:

faccenda said...

I always do this using:

$ ./command &> mylog

© Jadu Saikia www.UNIXCL.com