cheat:bzip2
---
tags: [ compression ]
---
# To compress a file (foo -> foo.bz2):
bzip2 -z foo
# To decompress a file (foo.bz2 -> foo)
bzip2 -d foo.bz2
# To compress foo to stdout:
bzip2 -zc foo > foo.bz2
# To decompress foo.bz2 to stdout:
bzip2 -dc foo.bz2
tldr:bzip2
# bzip2
# A block-sorting file compressor.
# More information: <https://manned.org/bzip2>.
# Compress a file:
bzip2 path/to/file_to_compress
# Decompress a file:
bzip2 -d path/to/compressed_file.bz2
# Decompress a file to standard output:
bzip2 -dc path/to/compressed_file.bz2
# Test the integrity of each file inside the archive file:
bzip2 --test path/to/compressed_file.bz2
# Show the compression ratio for each file processed with detailed information:
bzip2 --verbose path/to/compressed_files.bz2
# Decompress a file overwriting existing files:
bzip2 --force path/to/compressed_file.bz2
# Display help:
bzip2 -h
$
cheat.sh