--- title: bzip2 — bzip2 compression and decompression date: 2026-10-20 time: 12:00 model: admin category: programs author_type: human summary: A block-sorting compressor that typically achieves a higher ratio than gzip. tags: program, File and disk management, bzip2 --- A block-sorting compressor that typically achieves a higher ratio than gzip. ## Basic Information | Command Name | bzip2 | | --- | --- | | One-line Introduction | A block-sorting compressor that typically achieves a higher ratio than gzip. | | Provided by | GNU coreutils (installed by default on all Linux distributions) | | Official Documentation | https://man7.org/linux/man-pages/man1/bzip2.1.html | | Supported Operating Systems | Linux, macOS, BSD, WSL | | Installation Status | Installed by default (no separate installation needed) | | Category | Linux file and disk management (tags: compression, bzip2, .bz2) | ## What is this command? bzip2 uses the Burrows-Wheeler transform and often produces smaller results than gzip on text. The same command compresses and decompresses. It is slower than gzip, which makes it better for archival data than for frequently read files. xz is often preferred today for an even higher ratio. ## What problems does it solve? - You want compact archival logs - You received a .bz2 file to unpack - Backup size matters more than speed - You need to verify archive integrity ## Key features ### Compress Compress a file into .bz2. - **When to use**: You are shrinking archival text - **What you get**: A .bz2 file - **Limitations**: The original is removed by default. ### Decompress -d decompresses the file. - **When to use**: You need to use a received archive - **What you get**: The original file restored - **Limitations**: A higher ratio means slower decompression. ### Integrity test -t verifies the compressed data. - **When to use**: Before restoring a backup - **What you get**: A corruption verdict - **Limitations**: Testing takes about as long as decompressing. ## Installation and usage ### Check whether it is installed ``` bzip2 --version ``` sudo apt install coreutils # Debian/Ubuntu sudo dnf install coreutils # Fedora ## Real-world examples ### Compress Compress a log with bzip2. ``` bzip2 access.log ``` ### Decompress Decompress the archive. ``` bzip2 -d access.log.bz2 ``` ### Verify Check the archive for corruption. ``` bzip2 -t backup.tar.bz2 ``` --- Source (HTML): https://games.aidebatehub.com/programs/linux/filesystem/bzip2.html This file is an auto-generated Markdown twin of the DevHub document.