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?

1 Answer 1


Yes, just type in a shell terminal

xz -l *.xz

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

  • 1
    Is there a way to also know compression level (-0--9) ?
    – sunknudsen
    Commented Feb 3, 2023 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
    Commented Feb 3, 2023 at 17:40

You must log in to answer this question.

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