PSA: gz isn’t a generic compressed file extension

Software

Take a look at this filename, and take a guess what it is:

rootfs.gz

If you’re like me, you assumed gz meant gzip, and therefore I could extract it with gunzip(1):

$ gunzip rootfs.gz
==> gzip: rootfs.gz: not in gzip format

Wait, so what is this file file?

$ file rootfs.gz
==> XZ compressed data

This happens constantly. Is it a mild form of obfuscation? Do people think gz is a generic catch-all for all compressed data? Was a directive passed down to convert things to use xz, but tooling wasn’t updated to output the correct extension?

If I had a cent for each time this has happened, I’d still need many more to afford a coffee. But it’s more than nothing, which is what I hope people reading this blog conclude about the quality of my posts.

Author bio and support

Me!

Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.