LinuxCommandLibrary

bzcat

View compressed bzip2 files

TLDR

View documentation for the original command

$ tldr bzip2
copy

SYNOPSIS

bzcat [ option ... ] [ file.bz2 ... ]

PARAMETERS

-h, --help
    Display help and exit

-V, --version
    Show version information

-v, --verbose
    Increase verbosity

-q, --quiet
    Suppress non-error messages

-f, --force
    Force overwrite/processing

-k, --keep
    Keep input files (default)

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

-1 .. -9
    Set decompressor block size

DESCRIPTION

bzcat decompresses files compressed with bzip2 (.bz2 extension) and writes the output directly to standard output, mimicking the behavior of cat for uncompressed files.

It is ideal for streaming compressed content through pipes without disk I/O, such as bzcat large.log.bz2 | less to view huge logs, or bzcat data.bz2 | grep pattern for searching. Multiple files are processed sequentially, concatenating decompressed streams—perfect for multi-member bzip2 archives.

If no files are given, bzcat reads compressed data from stdin, enabling pipeline decompression like somecommand | bzip2 | bzcat | othercommand. Part of the bzip2 suite, it leverages Burrows-Wheeler transform for superior compression vs gzip, though slower.

bzcat is a lightweight wrapper invoking bzip2 in decompress-to-stdout mode (-dc). It supports many bzip2 decompression options for tuning verbosity, memory, and error handling. Efficient for read-only access; for in-place decompression, use bunzip2 or bzip2 -d. Memory-intensive for large blocks (default 900k), but adjustable.

CAVEATS

Outputs only to stdout—redirect (> file) or pipe to save. High memory for large files/blocks. Ignores compression options; stdin mode assumes valid bzip2 stream. No integrity check without -t (limited).

EXAMPLES

bzcat file.bz2 - output to terminal
bzcat *.bz2 > all.txt - combine files
bzcat access.log.bz2 | head -20 - first lines
tar -xjf archive.tar.bz2 - note: tar auto-handles (related)

HISTORY

Created by Julian Seward in 1996 with bzip2 0.9; stabilized in 1.0 (2000). Maintained for Linux/Unix; version 1.0.8 (2019) current. Integral to distros like Ubuntu/Debian for handling .bz2.

SEE ALSO

bzip2(1), bunzip2(1), zcat(1), cat(1), xzcat(1)

Copied to clipboard