LinuxCommandLibrary

lzcat

Decompress and concatenate compressed files to standard output

TLDR

View documentation for the original command

$ tldr xz
copy

SYNOPSIS

lzcat [file1] [file2] ...

PARAMETERS

[file1] [file2] ...
    One or more LZ-compressed files to decompress and concatenate.

-
    Read from standard input instead of a file.

DESCRIPTION

The lzcat command decompresses LZ-compressed files and writes the uncompressed data to standard output. It operates similarly to `gzip -cd` or `zcat`, but specifically for files compressed using the LZ (Lempel-Ziv) algorithm, typically with extensions like `.lz`. lzcat allows you to view the contents of LZ-compressed files without needing to manually decompress them first. It is particularly useful for examining log files, configuration files, or other text-based data that has been compressed to save space. If no files are specified on the command line or if a filename is specified as '-', lzcat reads from standard input. Multiple LZ-compressed files can be specified, and they will be concatenated into a single output stream.

Using it is often more efficient than decompressing to disk, especially with streaming or piping to other commands. lzcat handles filenames with spaces, but it may depend on the shell's quoting and escaping mechanisms.

USAGE EXAMPLES

Example 1: Display the content of `my_log.lz`:
lzcat my_log.lz

Example 2: Decompress two files and concatenate them to standard output:
lzcat file1.lz file2.lz

Example 3: Decompress from standard input and pipe to `less`:
cat compressed_data.lz | lzcat | less

SEE ALSO

lzma(1), unlzma(1), gzip(1), zcat(1), xz(1), xzcat(1)

Copied to clipboard