4

There are a lot of answers on how to create a tar.gz file with progress updates (ie. this answer, copied below)

tar cf - /folder-with-big-files -P | pv -s $(du -sb /folder-with-big-files | awk '{print $1}') | gzip > big-files.tar.gz

But how do I see the progress if I am tarring files without compression like so

tar -cvf output.tar folder/to/tar

2 Answers 2

11

While the accepted solution works it is just a bit of an abuse of process. There is a simpler and more elegant/correct solution -

tar -c /folder-with-big-files | pv -s $(du -sb /folder-with-big-files | awk '{print $1}') > bigfiles.tar

tar stands for Tape ARchive - and is designed to deal with streams. the "f" in "cf" tells tar to specifically create a file - rather then do this and specify a "-" to use stdout as this file.

1
  • 2
    Thanks for sharing that, davidgo. Note that the two folder paths (currently showing as /folder and /folder-with-big-files) need to match, as in @Kevin Rockwell's answer. Sep 22, 2018 at 1:08
3

Instead of putting the output through gzip, output to a file: tar cf - /folder-with-big-files -P | pv -s $(du -sb /folder-with-big-files | awk '{print $1}') > big-files.tar

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .