bzip2
Compress files using the Burrows-Wheeler block sorting algorithm for high compression.
Synopsis
bzip2 [OPTION]... [FILE]...
Examples
bzip2 large.log
bzip2 -k -9 data.bin
bzip2 -d archive.bz2
Common options
| Flag | Description |
|---|---|
| -d | Decompress |
| -k | Keep original file |
| -v | Verbose output |
| -z | Force compression |
| -1 to -9 | Block 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