Compression

bzip2

Compress files using the Burrows-Wheeler block sorting algorithm for high compression.

Synopsis

syntax
bzip2 [OPTION]... [FILE]...

Examples

Compress file (creates large.log.bz2)
bzip2 large.log
Best compression, keep original
bzip2 -k -9 data.bin
Decompress file
bzip2 -d archive.bz2

Common options

FlagDescription
-dDecompress
-kKeep original file
-vVerbose output
-zForce compression
-1 to -9Block size (compression level)

About bzip2

The `bzip2` command compress files using the Burrows-Wheeler block sorting algorithm for high compression. Compression commands reduce file sizes for storage and transfer.

Linux supports multiple compression formats, each with different speed and ratio trade-offs. Understanding these tools is essential for working with archives, backups, log rotation, and software distribution packages.

The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man bzip2`). The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More Compression Commands

Other commands in the Compression category

Related tools