{
    "mode": "info",
    "parameter": "zcat",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/zcat/json",
    "generated": "2026-06-08T16:18:55Z",
    "sections": {
        "1 Overview": {
            "content": "'gzip' reduces the size of the named files using Lempel-Ziv coding\n(LZ77).  Whenever possible, each file is replaced by one with the\nextension '.gz', while keeping the same ownership modes, access and\nmodification times.  (The default extension is 'z' for MSDOS, OS/2 FAT\nand Atari.)  If no files are specified or if a file name is '-', the\nstandard input is compressed to the standard output.  'gzip' will only\nattempt to compress regular files.  In particular, it will ignore\nsymbolic links.\n\nIf the new file name is too long for its file system, 'gzip'\ntruncates it.  'gzip' attempts to truncate only the parts of the file\nname longer than 3 characters.  (A part is delimited by dots.)  If the\nname consists of small parts only, the longest parts are truncated.  For\nexample, if file names are limited to 14 characters, gzip.msdos.exe is\ncompressed to gzi.msd.exe.gz.  Names are not truncated on systems which\ndo not have a limit on file name length.\n\nBy default, 'gzip' keeps the original file name in the compressed\nfile.  This can be useful when decompressing the file with '-N' if the\ncompressed file name was truncated after a file transfer.\n\nIf the original is a regular file, 'gzip' by default keeps its\ntimestamp in the compressed file.  This can be useful when decompressing\nthe file with '-N' if the timestamp was not preserved after a file\ntransfer.  However, due to limitations in the current 'gzip' file\nformat, fractional seconds are discarded.  Also, timestamps must fall\nwithin the range 1970-01-01 00:00:01 through 2106-02-07 06:28:15 UTC,\nand hosts whose operating systems use 32-bit timestamps are further\nrestricted to timestamps no later than 2038-01-19 03:14:07 UTC.  The\nupper bounds assume the typical case where leap seconds are ignored.\n\nCompressed files can be restored to their original form using 'gzip\n-d' or 'gunzip' or 'zcat'.  If the original name saved in the compressed\nfile is not suitable for its file system, a new name is constructed from\nthe original one to make it legal.\n\n'gunzip' takes a list of files on its command line and replaces each\nfile whose name ends with '.gz', '.z' '-gz', '-z', or 'z' (ignoring\ncase) and which begins with the correct magic number with an\nuncompressed file without the original extension.  'gunzip' also\nrecognizes the special extensions '.tgz' and '.taz' as shorthands for\n'.tar.gz' and '.tar.Z' respectively.  When compressing, 'gzip' uses the\n'.tgz' extension if necessary instead of truncating a file with a '.tar'\nextension.\n\n'gunzip' can currently decompress files created by 'gzip', 'zip',\n'compress' or 'pack'.  The detection of the input format is automatic.\nWhen using the first two formats, 'gunzip' checks a 32 bit CRC (cyclic\nredundancy check).  For 'pack', 'gunzip' checks the uncompressed length.\nThe 'compress' format was not designed to allow consistency checks.\nHowever 'gunzip' is sometimes able to detect a bad '.Z' file.  If you\nget an error when uncompressing a '.Z' file, do not assume that the '.Z'\nfile is correct simply because the standard 'uncompress' does not\ncomplain.  This generally means that the standard 'uncompress' does not\ncheck its input, and happily generates garbage output.  The SCO\n'compress -H' format (LZH compression method) does not include a CRC but\nalso allows some consistency checks.\n\nFiles created by 'zip' can be uncompressed by 'gzip' only if they\nhave a single member compressed with the \"deflation\" method.  This\nfeature is only intended to help conversion of 'tar.zip' files to the\n'tar.gz' format.  To extract a 'zip' file with a single member, use a\ncommand like 'gunzip <foo.zip' or 'gunzip -S .zip foo.zip'.  To extract\n'zip' files with several members, use 'unzip' instead of 'gunzip'.\n\n'zcat' is identical to 'gunzip -c'.  'zcat' uncompresses either a\nlist of files on the command line or its standard input and writes the\nuncompressed data on standard output.  'zcat' will uncompress files that\nhave the correct magic number whether they have a '.gz' suffix or not.\n\n'gzip' uses the Lempel-Ziv algorithm used in 'zip' and PKZIP.  The\namount of compression obtained depends on the size of the input and the\ndistribution of common substrings.  Typically, text such as source code\nor English is reduced by 60-70%.  Compression is generally much better\nthan that achieved by LZW (as used in 'compress'), Huffman coding (as\nused in 'pack'), or adaptive Huffman coding ('compact').\n\nCompression is always performed, even if the compressed file is\nslightly larger than the original.  The worst case expansion is a few\nbytes for the 'gzip' file header, plus 5 bytes every 32K block, or an\nexpansion ratio of 0.015% for large files.  Note that the actual number\nof used disk blocks almost never increases.  'gzip' normally preserves\nthe mode, ownership and timestamps of files when compressing or\ndecompressing.\n\nThe 'gzip' file format is specified in P. Deutsch, GZIP file format\nspecification version 4.3, Internet RFC 1952\n(https://www.ietf.org/rfc/rfc1952.txt) (May 1996).  The 'zip' deflation\nformat is specified in P. Deutsch, DEFLATE Compressed Data Format\nSpecification version 1.3, Internet RFC 1951\n(https://www.ietf.org/rfc/rfc1951.txt) (May 1996).\n",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}