Wednesday, February 24, 2010

How to redirect stdout and stderr output to file

Sometimes you need to redirect output of some command to file. The command may print its messages both on stdout and stderr device, in this case simply redirecting stdout to file does not help. Use following command to redirect both stdout and stderr output to file.
$ command 1 > outputfilename.txt 2 > &1

No comments:

Post a Comment