This page looks best with JavaScript enabled

How to use zstd compression tool

 ·  ☕ 1 min read

Zstandard (or zstd) is a lossless data compression algorithm developed by Yann Collet at Facebook and published under dual license - BSD + GPLv2. zstd is the reference implementation in C. zstd decompression is ~1300% faster then xz, so even Arch Linux decided to use it in main package compression scheme1.
You can read more about Zstandard on here: facebook.github.io/zstd.
Source code available at GitHub.

Usage

  • Compress a file into a new file with the .zst extension:

    zstd file
    
  • Decompress a file:

    zstd -d file.zst
    
  • Decompress a file to stdout:

    zstd -dc file.zst
    
  • Display information about a compressed file:

    zstd -l file.zst
    
  • Compress a file, while specifying the compression level (0 being worst, 19 best, and 3 default). For example, level 7:

    zstd -7 file
    
  • Use even higher compression levels 20+ (maximum 22), using a lot more memory:

    zstd --ultra -22 file
    
  • Compress using # working threads (default: 1). If # is 0, attempt to detect and use the number of physical CPU cores:

    zstd -T0 filename
    

Aliases

  • zstdmt is equivalent to zstd -T0
  • unzstd is equivalent to zstd -d
  • zstdcat is equivalent to zstd -dcf

All Options

You can read all zstd options in man pages:

man zstd

  1. According to a post on archlinux.org. ↩︎


Vladislav Pashinskikh
WRITTEN BY
Vladislav Pashinskikh
DevOps Engineer, GNU/Linux enthusiast, FOSS and privacy activist from Ukraine