LinuxCommandLibrary

bunzip2

Decompress BZ2 compressed files

TLDR

View documentation for the original command

$ tldr bzip2
copy

SYNOPSIS

bunzip2 [-cfkqsStvVL] [filename ...]

PARAMETERS

-c, --stdout
    Output to stdout, keep input files unchanged

-f, --force
    Overwrite output files without prompting

-k, --keep
    Keep (don't delete) input files

-L, --license
    Display licensing information

-q, --quiet
    Suppress non-error messages

-s, --small
    Use less memory (slower)

-t, --test
    Test compressed file integrity

-v, --verbose
    Verbose output

-V, --version
    Display version and exit

-1 .. -9
    Set block size (ignored in decompress)

DESCRIPTION

bunzip2 is a Linux command-line utility for decompressing files created by bzip2, which uses the Burrows-Wheeler transform and Huffman coding for high compression ratios, especially on text and repetitive data. It outperforms gzip in ratio but decompresses slower.

By default, bunzip2 file.bz2 extracts to file, removing the .bz2 original. Use -k to keep originals, -c for stdout output (no file changes, good for pipes), or -f to overwrite without prompts. It processes multiple files, auto-detects .bz2 via suffix, and supports integrity checks with -t.

Memory usage depends on block size (up to 9000k default); -s reduces it for low-RAM systems at speed cost. Widely used in backups, package management (e.g., Debian .deb), and data archiving. Errors if input isn't valid bzip2 format.

CAVEATS

Deletes original .bz2 by default; slow on large files; single-threaded; fails on non-bzip2 input.

EXAMPLES

bunzip2 file.bz2 (extracts to file, deletes original)
bunzip2 -k file.bz2 (keeps original)
bunzip2 -c file.bz2 | less (view without extracting)

NOTES

Equivalent to bzip2 -d; supports wildcards for multiple files.

HISTORY

Created by Julian Seward; bzip2 0.1 released September 1996, bunzip2 included as symlink to bzip2 -d mode.

SEE ALSO

bzip2(1), bzcat(1), gunzip(1), zcat(1)

Copied to clipboard