Linux: Compression How-to: tar gzip bzip2 xz 7zip rar zip

By Xah Lee. Date: . Last updated: .

This page shows you how to decompress or compress file or directory in Linux.

tar archive (.tar)

“tar” is unix standard for archiving a folder. Tar makes a directory into a single file. Tar does not compress.

Here's what the option means:

“tar” can untar and decompress in one step:

gzip compression (.gz)

gzip is unix standard for compressing a single file. gzip is often used together with tar.

bzip2 compression (.bz2)

Alternative to gzip, for compressing a single file. File size smaller than gzip.

xz compression (.xz)

Alternative to gzip, for compressing a single file. File size smaller than bzip2. xz is derived from 7-zip.

zip archive (.zip)

ZIP (file format) is for archiving and compressing a folder or single file. Originally from Microsoft Windows world.

7-zip archive (.7z)

7-zip is for archiving and compressing a folder (similar to zip). Originally from Microsoft Windows world. Compresses the best.

The 7z util can decompress many formats.

rar archive (.rar .rev .r00 .r01 .r02 …)

RAR (file format) is proprietary, from Windows world. Often used for pirated videos. File extension: {.rar .rev .r00 .r01 .r02 …}.

Compression File Size Comparison