Home·Terminal commands

zstd

Archives

Usage

zstd [-<level>] [-T0] <file>

The modern one: it reaches gzip’s size several times faster, and at `-19` it lands near xz sizes in a fraction of xz’s time; unlike gzip it keeps the source file by default (`--rm` deletes it), `-T0` uses every core, and tar calls it with `--zstd`.

Common flags

FlagMeaning
-1 .. -19Level. --ultra -22 goes further but costs a lot of memory.
-T0Use every core.
-dDecompress; unzstd and zstdcat also exist.
--rmDelete the source after success. Unlike gzip, zstd keeps it by default.
-cWrite to stdout.
-lShow what is inside a .zst file.
--long=27A large window that helps a lot on big, repetitive files.

Examples

zstd -19 -T0 dump.sql

Near-xz size at a fraction of the time; dump.sql stays where it is.

tar --zstd -cf backup.tar.zst ./data

A tar archive compressed with zstd.

zstd -d backup.tar.zst

Unpack it again.

Bundling and compressing are separate jobs: tar bundles, gzip shrinks, and .tar.gz is both.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does zstd do?

The modern one: it reaches gzip’s size several times faster, and at `-19` it lands near xz sizes in a fraction of xz’s time; unlike gzip it keeps the source file by default (`--rm` deletes it), `-T0` uses every core, and tar calls it with `--zstd`.

Q. How do I type it?

zstd [-<level>] [-T0] <file> — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

7 are listed here; the full set is in man zstd. This command sits under Archives.

Related commands

man page: man zstd