I am decompressing a list of files using gzip:

At any time it skips from one file to the next, I read (I am using the verbose option):

star_60out.txt.gz:   91.0% -- replaced with star_60out.txt

or

star_65out.txt.gz:   90.9% -- replaced with star_65out.txt

Does this mean that that it has only decompressed the 91% of these files?

up vote 6 down vote accepted

No worries, all is fine:

-v --verbose
Verbose. Display the name and percentage reduction for each file compressed or decompressed.

So, you're seeing how much the file was compressed, not some progress of the action itself.

It can even show negative values. Like if you wanted to test for yourself, and for that first generate a binary test file with random values, which is hard to compress:

$ head -c 100000 /dev/urandom > test.orig
$ file test.orig
test.orig: data

...and compress, which yields a file that is larger than the original:

$ gzip --keep test.orig
$ ls -l test.*
-rw-r--r--  1 arjan  staff  100000 Oct 18 11:36 test.orig
-rw-r--r--  1 arjan  staff  100063 Oct 18 11:36 test.orig.gz

...and decompress that, you'll see the funny negative value:

$ gzip -dcv test.orig.gz > test.new
test.orig.gz:  -0.1%

But even then all is fine, as the following shows no differences:

$ diff test.orig test.new

Finally, you can also use --list to see the (negative) compression ratio:

$ gzip --list test.orig.gz
compressed uncompressed  ratio uncompressed_name
    100063       100000  -0.1% test.orig

(Above output from OS X on a Mac.)

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.