This page shows you how to compress/decompress many formats on linux.
Here's a summary of which to choose:
“tar” is unix/linux standard for archiving a folder. It doesn't compress. To be used together with gzip or other. File extention: “.tar”.
tar cvf ‹new name.tar› ‹dirname›tar xvf ‹filename›The “x” is for “eXtract”, “v” = “verbose”, meaning print out status. “f” = file.
“tar” program can untar/decompress in one step:
tar xvfz ‹filename› for tar.gz file.tar xvfj ‹filename› for tar.bz2 file.tar xvfJ ‹filename› for tar.xz file.gzip is Linux standard for compressing a single file. Classic. Most widely used. Usually used together with tar. File extention: “.gz”.
gzip ‹filename›gzip -d ‹filename› or gunzip ‹filename›Alternative to gzip, for compressing a single file. File size smaller than gzip. File extention: “.bz2”.
bzip2 ‹filename›bzip2 -d ‹filename›Alternative to gzip, for compressing a single file. File size smaller than bzip2. xz is derived from 7-zip. File extention: “.xz”.
Here's size comparison:
emacs-24.2.tar.gz 49M emacs-24.2.tar.bz2 40M emacs-24.2.tar.xz 33M
xz ‹filename›unxz ‹filename› or xz -d ‹filename›ZIP (file format) is for archiving and compressing a folder or single file. Originally from Windows world. File extention: “.zip”.
zip -r ‹new name.zip› ‹dirname›unzip ‹filename›7-zip is for archiving and compressing a folder (similar to zip). Originally from Windows world. Compresses the best. File extention: “.7z”.
The 7z util can decompress many formats.
7z a -t7z ‹new name.7z› ‹dirname›7z e ‹filename›RAR (file format) is proprietary, from Windows world. Often used for pirated videos. File extention: {.rar .rev .r00 .r01 .r02 …}.
To extract rar files, use 7z e ‹filename›.