I was wondering what the difference is when decompressing using gzip -d and zcat.

Sometimes when I try gzip -d it says unknown suffix -- ignored. However, zcat works perfectly.

  • Welcome to the site. Please do not use picture. Post text instead. Feb 14 '20 at 21:45

The zcat equivalent using gzip is gzip -dc, and when used that way, it doesn’t care about the file extension. Both variants decompress their input and output the result to their standard output.

gzip -d on the other hand is intended to decompress a file, storing the uncompressed contents in another file. The output file’s name is calculated from the input’s, by removing its extension; files whose extension doesn’t match one of those handled by gzip are ignored. The documentation says that

gunzip takes a list of files on its command line and replaces each file whose name ends with .gz, -gz, .z, -z, or _z (ignoring case) and which begins with the correct magic number with an uncompressed file without the original extension. gunzip also recognizes the special extensions .tgz and .taz as shorthands for .tar.gz and .tar.Z respectively.

Files with no extension, or any other extension, are ignored, producing the message you see:

unknown suffix — ignored

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.