bunzip2: Decompress .bz2 Files in CI
bunzip2 decompresses .bz2 files and is equivalent to bzip2 -d, restoring the original by stripping the .bz2 suffix.
bunzip2 is the read side of bzip2. In CI you use -k to keep the archive and -c to stream it into tar or a grep.
What it does
bunzip2 reads a .bz2 file, decompresses it, writes the original name without the suffix, and deletes the compressed file unless -k is set. It is identical in behavior to bzip2 -d.
Common usage
Terminal
bunzip2 backup.tar.bz2 # -> backup.tar
bunzip2 -k data.bz2 # keep data.bz2
bunzip2 -c logs.bz2 | grep WARN
bunzip2 -t archive.bz2 # integrity testOptions
| Flag | What it does |
|---|---|
| -k / --keep | Keep the .bz2 file |
| -c / --stdout | Write to stdout |
| -t / --test | Test integrity only |
| -f / --force | Overwrite existing output |
| -v / --verbose | Report the compression ratio |
Common errors in CI
"bunzip2: <file> is not a bzip2 file" means the input is not .bz2, often a mislabeled gzip or xz. "bunzip2: Compressed file ends unexpectedly" is a truncated file; re-download. "bunzip2: Can't open input file <name>: No such file or directory" is a bad path.
Related guides
bzip2: Compress to .bz2 with -9 in CIbzip2 compresses files to .bz2 with the Burrows-Wheeler algorithm. Reference for -9, -k, -c, -d, and the comp…
pbzip2: Parallel bzip2 for Faster CIpbzip2 is a parallel bzip2 that uses multiple cores to write compatible .bz2 files faster. Reference for -p p…
bzcat: Stream bzip2 Files to stdoutbzcat decompresses .bz2 files to stdout without writing a file, the bzip2 counterpart to zcat. Reference for…
gunzip: Decompress .gz Files in Pipelinesgunzip decompresses .gz files, the inverse of gzip. Reference for -k keep, -c stdout, -t test, and the not-in…