Linux tar output sent to log file

I have a bit of a problem (or what seems like a problem to me). WHen running the tar from the linux console I get the following out put:

user@PC:~$ tar -cvf test.tar --totals ./files/examples/
./files/examples/
./files/examples/example00.dxf
./files/examples/example01.dxf
./files/examples/example02.dxf
./files/examples/example03.dxf
./files/examples/example04.dxf
./files/examples/swiss-map.png
./files/examples/swiss_map.dxf
Total bytes written: 399360 (390KiB, 3.1MiB/s)

This works great & works just as expected and is exactly the output I would like to see. However - when ever I run the same command and redirect the out put to a file for logging, I get:

user@PC:~$ tar -cvf test.tar --totals ./files/examples/ > test.log
Total bytes written: 399360 (390KiB, 16MiB/s)
user@PC:~$

The last bit of information Totals, is sent to STDOUT (console) rather than the log file. Would anyone know how I can get this information sent to my log?
NTNBowerAsked:
Who is Participating?
 
pjedmondConnect With a Mentor Commented:
You probably need to read this:

http://www.linux.com/guides/abs-guide/io-redirection.shtml

but:

tar -cvf test.tar --totals ./files/examples/ &> test.log

will direct stdout and stderr to the log file.

HTH:)

0
 
pjedmondCommented:
If you want to understand it all inside out, then you'll find this a 'fun' link:

http://www.cpqlinux.com/redirect.html

:)
0
 
NTNBowerAuthor Commented:
Perfect, thanks for the information it worked great, and I will check out the links you sent so I can get a better understainding of it.

It still strikes me as odd that the results of the internal option --totals sends its information to different output. From the above I would guess it is sending it to stderr - but doesnt that kind of seems like a bug?

Hands down you got the points, just curious if you might know why they did it this way.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.