LinuxCommandLibrary

gzcat

Display gzipped file contents

SYNOPSIS

gzcat [options] [file ...]

PARAMETERS

-c, --stdout
    write output to stdout (default)

-d, --decompress
    decompress (default for gzcat)

-f, --force
    force decompression, ignore CRC errors if possible

-h, --help
    display help message and exit

-l, --list
    list table of contents of gzip files

-L, --license
    display gzip license information

-N, --no-name
    do not restore original filename/timestamp

-q, --quiet, --silent
    suppress all warning messages

-t, --test
    test compressed file integrity

-v, --verbose
    print verbose information

-V, --version
    display version and copyright info

-S SUF, --suffix=SUF
    use alternate suffix (e.g., -S .tgz)

DESCRIPTION

gzcat is a Linux/Unix command-line utility that decompresses files compressed with gzip and writes the uncompressed data directly to standard output (stdout), without modifying the original files. It is functionally equivalent to gunzip -c or zcat, making it ideal for viewing compressed content, piping to other commands, or processing in scripts.

For example, gzcat access.log.gz | less displays a compressed log file interactively, or gzcat *.gz > combined.txt concatenates multiple files. If no files are specified, it reads from stdin, supporting pipelines like curl http://example.com/data.gz | gzcat.

gzcat handles multiple input files sequentially and supports concatenated gzip streams. It inherits most decompression options from gzip, allowing control over verbosity, error handling, and metadata preservation. Commonly used in system administration, data analysis, and backup restoration where preserving originals is crucial. Performance is efficient, leveraging the zlib library for fast decompression.

CAVEATS

Assumes valid gzip input; corrupted files may fail silently or with errors. Not for directories (use find + xargs). Memory usage scales with file size.

IMPLEMENTATION NOTE

Typically a symlink to gzip; parses own name to set -c -d defaults.

STANDARDS

Conforms to gzip format (RFC 1952); supports transparent multi-member streams.

HISTORY

Introduced with GNU gzip in 1992 by Jean-loup Gailly and Mark Adler, tied to zlib library development for portable compression. Evolved with gzip versions; widely available on Unix-like systems since mid-1990s.

SEE ALSO

gzip(1), gunzip(1), zcat(1), zless(1), zdiff(1)

Copied to clipboard