Learn how to a build a cloud-first strategyRegister Now


Linux tar output sent to log file

Posted on 2006-05-05
Medium Priority
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
  • 2
LVL 22

Accepted Solution

pjedmond earned 500 total points
ID: 16614415
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

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



Author Comment

ID: 16615077
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.

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month20 days, 21 hours left to enroll

810 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