This shows how to compress files or folders via command line, of many formats.

Common Compression FormatsEdit


for these examples "app" is a file or folder that you want to compress, and compressed fire that is created is "app.tar.*"

Command LineEdit

gzip formatEdit

tar -czvf app.tar.gz app

bz2 formatEdit

tar -cjvf app.tar.bz2 app

xz formatEdit

tar -cJvf app.tar.xz app

zip formatEdit

rar formatEdit

  • directory: rar a app.rar app/
  • file: rar a app.rar app
  • rar man page

LZMA formatEdit

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

7zip formatEdit

file: 7zr a app.7z app

Uncompressed archiveEdit

tar -cvf app.tar app


  • please add


Community content is available under CC-BY-SA unless otherwise noted.