bzip2
Quick Reference
Command Name:
bzip2
Category:
file compression
Platform:
linux
Basic Usage:
Common Use Cases
- 1
File compression
Compress files to save storage space
- 2
Archive creation
Create compressed archives of files and directories
- 3
Data backup
Create compressed backups of important data
- 4
Storage optimization
Reduce storage requirements through compression
Syntax
bzip2 [options] [filenames...] bunzip2 [options] [filenames...]
Options
Option | Description |
---|---|
-c, --stdout | Write to standard output and keep original files |
-d, --decompress | Force decompression (same as using bunzip2) |
-z, --compress | Force compression (default action) |
-t, --test | Test compressed file integrity |
-f, --force | Overwrite existing output files |
-k, --keep | Keep (don't delete) input files during compression/decompression |
-s, --small | Reduce memory usage (at the expense of compression ratio) |
-q, --quiet | Suppress non-error messages |
-v, --verbose | Show compression ratio for each file processed |
-1 to -9 | Set compression level: 1=fastest (less compression), 9=best (slowest) |
--fast | Same as -1 (fastest compression) |
--best | Same as -9 (best compression) |
-L, --license | Display software license |
-V, --version | Display version number |
-h, --help | Display help message |
Examples
How to Use These Examples
The examples below show common ways to use the bzip2
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
bzip2 filename.txt
bzip2 -k filename.txt
bunzip2 filename.txt.bz2
bzip2 -v filename.txt