zst - compress or decompress .zst/.bz2/.gz/.xz files
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.
Mode of operation
- -z
- 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.
- -d
- Decompress. Files without a known suffix will be left untouched.
- -t
- Test the integrity of compressed files; this is functionally same as
decompression redirected to /dev/null.
Modifiers
- -c
- Write compressed or decompressed data to standard output. This implies
-k. For compression, if the stdout is a terminal, -f must be
also specified.
- -k
- The source file won't be removed after [de]compression.
- -f
- 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.
- -r
- 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.
- -v
- List all processed files. When compressing, the old, new, and percentage
of required size is given.
- -q
- Suppress all warnings. Unrelated to -v.
- -n
- Ignored; for compat with gzip.
- -F
- Specify compression algorithm to use.
1 if any errors happened, 2 if there's a warning but
no errors, 0 if all went ok.
zstd(1), bzip2(1), gzip(1), xz(1).