Scroll to navigation

zst(1) General Commands Manual zst(1)

NAME

zst - compress or decompress .zst/.bz2/.gz/.xz files

SYNOPSIS

zst [options] files...

DESCRIPTION

The zst command can reduce the size of files by using a number of popular compression algorithms; in this version these are zstd, bzip2, xz, gzip -- and decompress them back.

While these compressors' native tools may expose more options specific to the algorithm in question, zst unifies them with common functionality. Eg, only gzip and zstd can recurse with -r, zstd defaults to -k and its levels go up to 19 rather than 9, etc.

The default compressor is zstd as it's fastest while also compressing well; you may want to use xz instead when disk space / network bandwidth is at premium. On the other hand, neither gzip nor bzip2 are a superior choice in any case but especially gzip is entrenched for historical reasons.

OPTIONS

Mode of operation

Compress (default). The file will be replaced by a compressed copy with an appropriate suffix added: .zst/.bz2/.xz/.gz according to the algorithm used.
Decompress. Files without a known suffix will be left untouched.
Test the integrity of compressed files; this is functionally same as decompression redirected to /dev/null.

Modifiers

Write compressed or decompressed data to standard output. This implies -k. For compression, if the stdout is a terminal, -f must be also specified.
The source file won't be removed after [de]compression.
Will overwrite existing files. Allows writing compressed data to a terminal. When -c is given and the data is not in the expected format, it will be passed through unmodified. Allows compressing a file that's already compressed.
If a directory is among file names specified on the command line, all files inside will be processed, possibly recursing into directories deeper in.
-1..-9
Compression level: -1 is the weakest but fastest level the algorithm knows, -9 is strongest and slowest. Note that unlike the zstd tool, the scale is 1..9 for all algorithms -- level 9 corresponds to what zstd knows as 19.

The defaults are: zst 2, bz2 9, gz 6, xz 6.

List all processed files. When compressing, the old, new, and percentage of required size is given.
Suppress all warnings. Unrelated to -v.
Ignored; for compat with gzip.
Specify compression algorithm to use.

RETURN VALUE

1 if any errors happened, 2 if there's a warning but no errors, 0 if all went ok.

SEE ALSO

zstd(1), bzip2(1), gzip(1), xz(1).

2022-10-18