← 返回命令列表

Linux command

zstd 命令

文件

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

常用示例

Compress a file

zstd [file]

Decompress a file

zstd -d [file.zst]

Compress keeping original file

zstd -k [file]

Compress with maximum compression

zstd -19 [file]

Compress ultra

zstd --ultra -22 [file]

Compress with fastest speed

zstd -1 [file]

Compress to stdout

zstd -c [file] > [file.zst]

Decompress to stdout

zstd -dc [file.zst]

Compress with multiple threads

zstd -T0 [file]

Test archive integrity

zstd -t [file.zst]

说明

Zstandard (zstd) is a fast lossless compression algorithm providing high compression ratios. It offers a wide range of compression/speed trade-offs, from ultra-fast to ultra-compression modes. At similar compression ratios, zstd is typically faster than zlib/gzip and significantly faster than xz/lzma. Higher compression levels approach xz ratios while maintaining faster decompression. zstd supports dictionary compression for small files, parallel compression, and can serve as a drop-in replacement for gzip in many workflows. The format is defined in RFC 8478.

参数

-d, --decompress
Decompress files.
-k, --keep
Keep source files.
-c, --stdout
Write to stdout.
-1 to -19
Compression level (default 3).
--ultra
Enable ultra compression (levels 20-22).
-T _n_, --threads= _n_
Number of threads (0=auto).
-t, --test
Test compressed file integrity.
-l, --list
List compressed file information.
-f, --force
Force overwrite/compression.
-r
Recurse into directories.
--rm
Remove source file after compression.
-D _dict_
Use dictionary for compression.
--train
Create dictionary from samples.
-q, --quiet
Suppress output.
-v, --verbose
Verbose mode.

FAQ

What is the zstd command used for?

Zstandard (zstd) is a fast lossless compression algorithm providing high compression ratios. It offers a wide range of compression/speed trade-offs, from ultra-fast to ultra-compression modes. At similar compression ratios, zstd is typically faster than zlib/gzip and significantly faster than xz/lzma. Higher compression levels approach xz ratios while maintaining faster decompression. zstd supports dictionary compression for small files, parallel compression, and can serve as a drop-in replacement for gzip in many workflows. The format is defined in RFC 8478.

How do I run a basic zstd example?

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

What does -d, --decompress do in zstd?

Decompress files.