LinuxCommandLibrary

xzcat

Decompress and print xz-compressed files to standard output

TLDR

View documentation for the original command

$ tldr xz
copy

SYNOPSIS

xzcat [OPTION]... [FILE]...

PARAMETERS

-k, --keep
    Do not delete the input file(s) after successful decompression. By default, xzcat processes files non-destructively, but this option explicitly ensures the original file remains.

-f, --force
    Force operations. This can be used to overwrite an existing output file (if redirecting output) or to decompress even if the input is not in .xz format (when reading from standard input).

-t, --test
    Test the integrity of the compressed file(s). This option checks the file's consistency without actually decompressing it to standard output. The exit status indicates whether the test passed or failed.

-q, --quiet
    Suppress all warnings and error messages, except for fatal errors.

-v, --verbose
    Display more information during processing, such as the name of the file being processed.

--help
    Display a help message and exit.

--version
    Display version information and exit.

DESCRIPTION

xzcat is a utility designed to decompress files compressed with the XZ algorithm and write the uncompressed data to standard output. It is effectively equivalent to running the xz command with the --decompress (-d) and --stdout (-c) options. This command is particularly useful for quickly viewing the contents of an .xz compressed file without having to permanently uncompress it or store the decompressed version on disk. It behaves much like cat, but for XZ-compressed data, allowing users to pipe the output to other commands, redirect it to a file, or simply display it on the terminal. It can process multiple files, concatenating their decompressed content in the order specified.

CAVEATS

xzcat is designed exclusively for .xz compressed files; it will not work with other compression formats like .gz or .bz2. When decompressing large files to the terminal without redirection, the output can quickly scroll off the screen. For large files, it's advisable to pipe the output to a pager like less (e.g., xzcat file.xz | less) or redirect it to a new file.

USAGE WITH PIPES

xzcat is frequently used in conjunction with pipes (|) to feed decompressed data directly into other commands. For example, xzcat log.xz | grep 'error' would decompress log.xz and then search for lines containing 'error' without ever saving the decompressed log to disk.

SYMBOLIC LINK

In many Linux distributions, xzcat is often implemented as a symbolic link to the main xz executable, or it's a simple shell script that invokes xz -dc. This ensures consistent behavior and reduces redundancy in the system.

HISTORY

xzcat is part of the XZ Utils software package, which replaced LZMA Utils as the standard implementation of the LZMA2 compression algorithm. It was developed to provide a powerful and efficient compression/decompression tool for various Linux and Unix-like systems. xzcat emerged alongside the xz command itself, providing a convenient 'cat-like' interface for viewing the contents of .xz files, streamlining workflows where temporary decompression for viewing or piping is required.

SEE ALSO

xz(1), cat(1), zcat(1), bzcat(1)

Copied to clipboard