Why can’t you combine <code>.tar.gz</code> files with <code>cat</code>? 0 ▲ alexwlchan 1 hour ago · 6 min read1166 words · Tech · hide · 0 comments 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… No comments yet. Log in to reply on the Fediverse. Comments will appear here.