Browse Docs

๐Ÿ—œ Compression

Zip / Unzip

1zip <archive.zip> <file1> <file2>     # compress files.
2zip -r <archive.zip> <directory>      # compress a directory.
3unzip archive_name.zip [-d directory] # decompress an archive.

Gzip / Gunzip

gzip is based on the Deflate algorithm (a combination of the LZ77 and Huffman algorithms).

1gzip -l                                          # show the size of the uncompressed file.
2gzip <file>                                      # compress.
3gunzip <file.gz> | gzip -d <file.gz>             # decompress.
4gzip -9 <my_file>                                # compress a file optimally.
5gzip -c <file1> <file2> > compressed_file.gz     # compress several files into a single one.

Bzip2 / Bunzip2

bzip2 is an alternative to gzip, more efficient but slower.

1bzip2 <file>                        # compress a file.
2bunzip2 <compressed_file.bz2>       # decompress a bzipped file.

XZ / LZMA

LZMA is more efficient and faster than bzip2, but uses more memory.

1xz <file>                       # compress a file.
2xz -d <compressed_file.xz>      # decompress a file.

Compress / Uncompress (LZW)

compress is a compression utility based on the Lempel-Ziv-Welch (LZW) algorithm. It is not the most efficient and, since the compression algorithm is patented in some countries, most GNU/Linux distributions do not include it by default.

1compress <file>                     # compress a file.
2uncompress <compressed_file.Z>      # decompress a file.
Sunday, October 4, 2026 Wednesday, August 2, 2023