Gzipped Tarball [updated] -
But gzip cannot pack multiple files. Give it a directory, and it says: “No, thanks.”
| Feature | .tar.gz | .zip | |--------|-----------|--------| | Preserves Unix permissions | ✅ Yes | ❌ No (ignores execute bits, symlinks) | | Streamable | ✅ Yes (tape/pipe friendly) | ❌ Needs central directory at end | | Open standard | ✅ Fully | ⚠️ Partially (some extensions proprietary) | | Compression ratio | ✅ Very good (DEFLATE) | ✅ Same algorithm | | Random access | ❌ Painful | ✅ Possible | gzipped tarball
So why not just use a ZIP file? Because tar preserves Unix file attributes (symlinks, hard links, device files, executables) in a way ZIP never quite got right. It’s the native “archive” format of the Unix world. But gzip cannot pack multiple files
Let’s unpack it. (Pun intended.) First, meet tar (Tape ARchive). Born in the early days of Unix, tar was designed for tape drives . Its job was simple: Take a bunch of files and folders, glue them into one big byte stream, preserving permissions, owners, and directory structure. That’s it. No compression. Just packing . It’s the native “archive” format of the Unix world
For source code, system backups, and Docker layers, .tar.gz wins because it faithfully restores the original environment.