Home / Alt manpages / zstdless(1)

  • zstdless(1)
  • User command
  • linux

Read Zstandard Files Safely with zstdless

zstdless opens one or more Zstandard-compressed files straight in less, no uncompressed copy created along the way. Allow about five minutes. You need the zstd package, a terminal, and a readable .zst file.

The examples below match the installed zstd 1.5.7 command, while the local manual page identifies its documented interface as zstd 1.5.5.

Checkpoint

This guide only reads and decompresses data for display. It does not alter the compressed files, services or system configuration.

1. Confirm the wrapper and its dependency

Check that both the viewer and the decompressor are available:

$ command -v zstdless
/home/linuxbrew/.linuxbrew/bin/zstdless
$ zstd --version
*** Zstandard CLI (64-bit) v1.5.7, by Yann Collet ***

Your paths and version can differ. The important detail: zstdless is a small wrapper around less. Its installed script sets LESSOPEN to run zstd -cdfq for files that less opens, then passes your arguments straight to less.

If command -v zstdless prints nothing, install the distribution's zstd package through its normal package manager. That's an administrative action and sits outside this viewing workflow.

2. Open one compressed file

Give the compressed path as the file argument:

$ zstdless /path/to/application.log.zst
  • You're now in the ordinary less interface. Use its usual navigation: Space for the next page, b for the previous page, q to quit.
  • No replacement file is written. The decompressed text is produced only for the pager, so no .log file appears alongside the source.

To verify the input without opening it interactively, ask zstd to test the frame:

$ zstd -t /path/to/application.log.zst
/path/to/application.log.zst: 1 stream
$ printf '%s\n' "$?"
0

The exact test output can vary with the installed release. A zero status is the result that matters. A non-zero status means the file is damaged, truncated, not a Zstandard frame, or otherwise could not be tested.

3. View several files in sequence

The synopsis accepts multiple file arguments. Pass them together when you want to move between related compressed logs in one pager session:

$ zstdless /var/log/myapp/app-2026-09-27.log.zst \
    /var/log/myapp/app-2026-09-28.log.zst

Use the less commands :n and :p to move to the next and previous input file. The shell line continuation above is only for readability; drop the backslash if you put the command on one line.

Common trap: options after the command go to less, not to zstd. For example, -N asks less to show line numbers. Do not append decompressor options to zstdless and assume the wrapper passes them to zstd; the installed script deliberately has no separate zstd flag mechanism.

4. Read compressed data from standard input

With no file argument, zstdless reads standard input, which is useful when another command produces a Zstandard stream:

$ zstd -q -c /path/to/application.log | zstdless

Here zstd -c writes compressed data to standard output and zstdless presents the decompressed text. The first command is only a demonstration of a pipeline: for an existing compressed file, use zstdless /path/to/file.zst directly.

For a quick non-interactive check, make the pager finish after one screen:

$ printf '%s\n' 'alpha' 'beta' | zstd -q | LESS='-F -X' zstdless
alpha
beta

LESS='-F -X' is temporary for this one command. -F quits when the output fits on one screen and -X leaves the output visible. Do not use that setting as a test for large files, where the pager stays interactive.

5. Separate viewer settings from decompression

The wrapper honours the ZSTD environment variable when choosing the decompressor command. That's a compatibility hook, not a place to put an arbitrary shell pipeline. Leave it unset unless you have a specific, trusted command with compatible options:

$ env ZSTD=/usr/bin/zstd zstdless /path/to/application.log.zst

Prefer the default. An incorrect value can make every file fail to open, and an untrusted value would change which executable actually runs. If you set ZSTD in your shell profile and viewing breaks, remove that setting or run the command with a known path as above, then open a new shell after correcting the profile.

There's no need for sudo to view a file you can already read. If a log is root-readable only, ask the owner for an appropriate copy or access arrangement. Don't teach yourself to run a pager as root: pagers can execute interactive commands, and elevated viewing raises the impact of any mistake.

Common traps

  • Pager reports it can't open the file. Check the path and read permission with ls -l /path/to/file.zst.
  • Display looks like compressed bytes. Confirm the input is actually Zstandard data and that you didn't bypass the wrapper with plain less.
  • Decompression reports corruption. Keep the original file. Don't overwrite it with a guessed repair or an empty output file; get another copy and compare checksums if one is available.
  • Expected file isn't present. zstdless passes file names to less, and shell globs are expanded before the wrapper runs. Quote a path with spaces, and check what a glob matched with printf '%s\n' /path/to/*.zst.

Checkpoint

Quit the pager with q, then run zstd -t on the same file. That separates a pager or path problem from genuinely damaged compressed data, without changing anything.

Done means

  • You opened the intended .zst file with zstdless.
  • You navigated it with normal less commands and quit with q.
  • You know wrapper arguments are pager arguments, not zstd arguments.
  • You can test the compressed frame with zstd -t and keep the original when it fails.