zstd(1)
zstd is a fast real-time compression algorithm that provides high compression ratios with faster speed than gzip or bzip2.
Synopsis
zstd [OPTION]... [FILE]...Description
zstd (Zstandard) is a modern compression utility offering excellent speed-to-ratio tradeoffs. It compresses files to .zst format and supports both compression and decompression with configurable compression levels (1-22). zstd is significantly faster than gzip at similar compression levels and is increasingly used in Linux distributions and archival tools.
By default, zstd compresses files in-place, removing the original and creating a .zst file. It supports parallel compression, streaming, and dictionary-based compression for optimal results on similar data.
Common options
| Flag | What it does |
|---|---|
-d, --decompress | Decompress the file (reverse operation) |
-k, --keep | Keep input file; don't delete it after compression/decompression |
-f, --force | Overwrite output file without prompting |
-1 to -22 | Set compression level (1=fastest, 22=best ratio; default is 3) |
-T#, --threads=# | Use # threads for parallel compression (0=auto-detect) |
-c, --stdout | Write compressed data to stdout instead of file |
-o FILE, --output=FILE | Write output to FILE instead of default name |
-v, --verbose | Show compression progress and statistics |
-q, --quiet | Suppress messages and progress info |
-r, --recursive | Recursively compress all files in directories |
--ultra | Enable ultra compression levels (20-22, slower) |
Examples
Compress file.txt to file.txt.zst, removing the original
zstd file.txtCompress file.txt to file.txt.zst while keeping the original
zstd -k file.txtDecompress file.txt.zst back to file.txt
zstd -d file.txt.zstCompress with maximum compression ratio (slower but smaller)
zstd -22 large.isoCompress multiple files using 4 threads, output to archive.zst
zstd -T4 -o archive.zst file1.txt file2.txt file3.txtCompress stdin to stdout, useful for piping
cat file.bin | zstd -c > file.bin.zstRecursively compress all files in the data/ directory
zstd -r data/Compress with auto-detected threads, showing verbose output
zstd -v -T0 backup.tar