I have a couple of big files that I would like to compress. I can do this with for example
tar cvfj big-files.tar.bz2 folder-with-big-files
The problem is that I can't see any progress, so I don't have a clue how long it will take or anything like that. Using v
I can at least see when each file is completed, but when the files are few and large this isn't the most helpful.
Is there a way I can get tar to show more detailed progress? Like a percentage done or a progress bar or estimated time left or something. Either for each single file or all of them or both.
Best Answer
I prefer oneliners like this:
It will have output like this:
For OSX (from Kenji's answer)
Explanation:
tar
tarball toolcf
create file-
use stdout instead of a file (to be able to pipe the output to the next command)/folder-with-big-files
The input folder to zip-P
use absolute paths (not necessary, see comments)pipe to
pv
progress monitor tool-s
use the following size as the total data size to transfer (for % calculation)$(...)
evaluate the expressiondu -sb /folder-with-big-files
disk usage summarize in one line with bytes. Returns eg8367213097 folder-with-big-files
awk '{print $1}'
which returns only the first part of thedu
output (the bytes, removing the foldername)pipe to
gzip
gzip compression toolbig-files.tar.gz
output file name