LinuxCommandLibrary

zstdcat

Decompress and print zstd compressed files

TLDR

View documentation for the original command

$ tldr zstd
copy

SYNOPSIS

zstdcat [OPTIONS] [FILE...]
If no FILE is specified, zstdcat reads from standard input.

PARAMETERS

FILE...
    One or more Zstandard-compressed files to decompress. If omitted, zstdcat reads from standard input.

-d, --decompress
    (Implied) Forces decompression. zstdcat inherently operates in decompression mode.

-c, --stdout
    (Implied) Writes the decompressed data to standard output. zstdcat inherently writes to stdout.

-q, --quiet
    Suppress all messages, warnings, and errors during operation, except for critical issues.

-V, --version
    Display the zstd version number and exit.

-h, --help
    Display a help message and exit.

-o FILE, --output FILE
    Decompress the input to the specified FILE instead of standard output.

--no-sparse
    Disable sparse file creation during decompression, relevant if the output is written to a file.

--check
    Verify the integrity of the decompressed data by checking its checksum.

--memory=LIMIT
    Set a memory usage limit for decompression, in bytes or with common suffixes (K, M, G).

DESCRIPTION

zstdcat is a specialized utility designed to decompress files compressed with the Zstandard algorithm (typically with a .zst extension) and write the decompressed data directly to standard output (stdout). It functions as a convenient wrapper for the core zstd command, effectively executing zstd --decompress --stdout [FILE...].

Its primary purpose is to allow users to view the contents of Zstandard-compressed files without needing to explicitly decompress them to disk first. This makes it ideal for quickly inspecting log files, configuration files, or other text-based data that has been compressed for storage efficiency. You can easily pipe its output to other commands like less, grep, or awk for further processing or viewing, for example, zstdcat mylog.zst | grep "ERROR".

When no file arguments are provided, zstdcat reads the compressed data from standard input, enabling it to be part of a pipeline (e.g., curl example.com/data.zst | zstdcat). It is the Zstandard equivalent of zcat for gzip files or xzcat for xz files, providing a consistent interface across different compression formats for immediate content access.

CAVEATS

zstdcat is designed exclusively for Zstandard (.zst) compressed files and cannot decompress other formats like gzip or xz.
It primarily outputs to standard output, which is generally suitable for text. Care should be taken when piping decompressed binary data to a terminal, as it might lead to unexpected behavior.
If the input .zst file is corrupted, zstdcat will report an error and fail to decompress, potentially producing an incomplete or no output.
While Zstandard is highly backward compatible, extremely old or malformed Zstandard frames might not be perfectly handled by newer zstdcat versions.

PIPING OUTPUT

zstdcat is frequently used in pipelines to process or view the content of compressed files without creating temporary uncompressed files. For example, to view a compressed log file: zstdcat mylog.zst | less. To search within a compressed file: zstdcat data.csv.zst | grep 'pattern'.

READING FROM STANDARD INPUT

When invoked without any file arguments, zstdcat automatically reads compressed data from standard input. This allows for flexible use cases, such as decompressing data received from a network stream: curl example.com/data.zst | zstdcat.

HISTORY

The zstd compression algorithm and its associated tools, including zstdcat, were developed by Yann Collet at Facebook and open-sourced in 2016. zstdcat was created as part of the zstd suite, following the established convention of zcat (for gzip) and xzcat (for xz), providing a familiar and convenient interface for decompressing Zstandard files directly to standard output without needing to explicitly specify decompression options. Its development is tied to the continuous evolution and adoption of the Zstandard compression format, known for its high compression ratios and extremely fast compression/decompression speeds.

SEE ALSO

zstd(1), zcat(1), xzcat(1), cat(1), less(1), more(1)

Copied to clipboard