Why can’t you combine <code>.tar.gz</code> files with <code>cat</code>? 0 ▲ alexwlchan 90 days ago · 6 min read1166 words · Tech · hide · Fediverse post I’m working on a project that generates multiple .tar.gz archives, and I need to combine them into one final file. I thought I could just cat the bytes together, but that doesn’t work. This seemingly simple task exposed my flawed understanding of tar and gzip. To my fix my code, I first had to fix my mental model – and that took me into tape drives, patent laws, and end-of-file markers. tar stands for tape archive tar is a file archiver that combines multiple files and their metadata – filenames, timestamps, directory structure – into a single file. It was originally designed for magnetic tapes, and the file structure is informed by the physical constraints of that medium: Sequential reads. Magnetic tapes are most efficient when you start at the beginning, and play forward to the end of the tape. Append-only writes. Early tapes could only append data to the end of a record, not replace existing data. Fixed data sizes. Tapes have a fixed capacity, and early tapes had fixed data block… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town