2

I want to redirect output of a tar command to one file say, out.log and errors during execution should be redirected to another file for example, error.log.

How can I achieve this?

2 Answers2

2

Here you Go,

tar command 2> error.log 1> out.log

To append to the existing log

tar command 2>> error.log 1>> out.log

upkar
  • 326
0

You can use > to redirect standard output, and &2> to redirect standard error. So in your example:

tar whatever > out.log 2> error.log

hoe
  • 301
  • 1
  • 2
  • 6