Linux tar output sent to log file

Posted on 2006-05-05
Last Modified: 2013-12-16
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/
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)

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?
Question by:NTNBower
    LVL 22

    Accepted Solution

    You probably need to read this:


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

    will direct stdout and stderr to the log file.


    LVL 22

    Expert Comment

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


    Author Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Title # Comments Views Activity
    the wild card doesn't work in gulp function 1 57
    wordpress email form 23 59
    VMWare Workstation 12.0 3 69
    Open Camera IP 8 64
    This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
    Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now