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?

Stephen Rauch
  • 4,209
  • 14
  • 22
  • 32
Girish Sunkara
  • 753
  • 4
  • 9
  • 20

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
  • 316
  • 2
  • 12
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