How To Wiki

Howto compress files in Unix

1,797pages on
this wiki
Add New Page
Talk0 Share

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


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.