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
    mkdir lzma
    cd lzma
    tar xjvf ../lzma443.tar.bz2
  3. Compile LZMA_Alone
    cd C/7zip/Compress/LZMA_Alone
    make -f makefile.gcc

    You get a lot of warning, just ignore them.

  4. If compilation was successful, copy lzma somewhere into your path:
    sudo cp lzma /usr/local/bin/

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

  • Fast compression:
     tar -cv gimp |lzma e -a0 -d15 -fb16 -mfhc4 -si -so >gimp.tar.lzma
  • Normal compression:
     tar -cv gimp |lzma e -d21 -fb32 -si -so >gimp.tar.lzma
  • Maximum compression:
     tar -cv gimp |lzma e -si -so >gimp.tar.lzma
  • Ultra compression:
     tar -cv gimp |lzma e -d25 -si -so >gimp.tar.lzma

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

cat gimp.tar.lzma | lzma d -si -so | tar xv

Have fun!