Given a gzip compressed file, how do I know what compression level (1-9) was used for it?

link|improve this question
feedback

2 Answers

up vote 3 down vote accepted

There is no way to directly determine gzip level .
The only way to determine it in my opinion is to gunzip the file and compressing it at different levels and then comparing the results with your existing file size.
I believe the default level is 6 so in most cases that should be your answer

link|improve this answer
I read somewhere that tar -cz defaults to 9. Is that true? – rabin Apr 12 '11 at 16:37
Yes. GNU tar uses level 9 by default when gzipping. – Amazed Apr 12 '11 at 17:26
feedback

gzip -l <filename> will give you the compression ratio, but there's no way of directly finding the compression level used.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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