9

In windows by default one can see the compression ratio of zip files and after installing WinRAR it also supports this feature but currently I am using a linux and have compressed a file using lzma2 and xz as the container but how can I check the compression ratio without comparing the original file size and the compressed file size? Is it even possible?

PSP
  • 195
  • 3
  • 7

1 Answers1

16

Yes, just type in a shell terminal

xz -l *.xz

You can even get more information if you specify option -v once or twice.

rudimeier
  • 9,967
  • 2
  • 33
  • 45
  • 1
    Is there a way to also know compression level (`-0`-`-9`) ? – sunknudsen Feb 03 '23 at 16:55
  • 1
    @sunknudsen Yes, try option ```-lvv```, then it shows you the used DictSize, e.g. ```--lzma2=dict=16MiB```. This size can be translated back to the optons ```-0..-9```, according to the table in the man-page: ```man xz```. – rudimeier Feb 03 '23 at 17:40