← 返回命令列表

Linux command

bzip2 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Compress

bzip2 [file.txt]

Decompress

bzip2 -d [file.txt.bz2]

Keep

bzip2 -k [file.txt]

Compress

bzip2 -c [file.txt] > [file.txt.bz2]

Example

bzip2 -9 [file.txt]

说明

bzip2 compresses files using the Burrows-Wheeler block-sorting compression algorithm. It typically achieves better compression ratios than gzip but is slower. By default, it replaces the original file with a compressed .bz2 file. The tool is commonly used for compressing tarballs and large files.

参数

-z, --compress
Force compression (default behavior)
-d, --decompress
Decompress file
-k, --keep
Keep original files
-f, --force
Overwrite existing files
-c, --stdout
Write to standard output
-t, --test
Test compressed file integrity
-v, --verbose
Verbose mode (repeat for more detail)
-1 to -9
Compression level (1=fast, 9=best, default: 9)
--fast
Alias for -1
--best
Alias for -9
-s, --small
Use less memory for compression/decompression (at most 2500 KB)
-q, --quiet
Suppress non-critical warnings
-L, --license
Display license and version information

FAQ

What is the bzip2 command used for?

bzip2 compresses files using the Burrows-Wheeler block-sorting compression algorithm. It typically achieves better compression ratios than gzip but is slower. By default, it replaces the original file with a compressed .bz2 file. The tool is commonly used for compressing tarballs and large files.

How do I run a basic bzip2 example?

Run `bzip2 [file.txt]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -z, --compress do in bzip2?

Force compression (default behavior)