LZMA Compression in Linux

7-zip has one of the best compression ratio / decompression speed ratios of the planet. Give it a try, compression ratio is a bit better than RAR, and decompression is faster. The linux port is p7zip.

Unfortunately you cannot use 7zip for streams like gzip or bzip2. 7zip uses LZMA as the compression routine, and it is possible to use just this high end compressor to get the best of both worlds.

This is how to get it:

  1. Download LZMA SDK from here.
  2. Extract it:
  3. Compile LZMA_Alone:
    You get a lot of warning, just ignore them.
  4. If compilation was successful, copy lzma somewhere into your path:

Now you are ready to compress/decompress stuff. Here are some examples, when compressing the folder gimp:

  • Fast compression:
  • Normal compression:
  • Maximum compression:
  • Ultra compression:

And finally, this is how to extract gimp.tar.lzma:

Have fun!

5 Comments on "LZMA Compression in Linux"

Notify of
avatar
erde
Guest

i searched tar command that with lzma compress method.
your post is a help to me
thankyou!

ubuntu tips
Guest

i did that tricks but it’s error like this “lzma: invalid option — ‘s’
what sould i do??

sf
Guest

I used the following in natty: “tar -cv gimp |lzma -9 >gimp.tar.lzma” note there’s also an alias “–best”. For more info see “man lzma”.

Oehr
Guest

uncompressing can be done with a more memorable command line as well:
tar -xvf –lzma gimp.tar.lzma

Oehr
Guest

err i meant:
tar –-lzma -xvf gimp.tar.lzma

also: –lzma needs to be set before -xvf

wpDiscuz