4 ms·
> the fact that you cannot get a valid bzip2 file by cat-ing 2 compressed files TIL. Now that's why gzip has a file header! But, tar.gz compresses even better,
by sedatk 7mo ago
> the fact that you cannot get a valid bzip2 file by cat-ing 2 compressed files
TIL. Now that's why gzip has a file header! But, tar.gz compresses even better, that's probably why it hasn't caught on.
- pocksuppet 7mo agotar packs multiple files into one. If you concatenate two gzipped files and unzip them, you just get a concatenated file.
- sedatk 7mo agoAh okay, I thought gzip would support decompressing multiple files that way.
- kergonath 7mo agoHow it works is, if you have two files foo.gz and bar.gz, and cat foo.gz bar.gz > foobar.gz, then foobar.gz is a valid gzip file and uncompresses to a single file with the contents of foo and bar. It’s handy because it is very easy to just append stuff at the end of a compressed file without having to uncompress-append-recompress. It is a bit niche but I have a couple of use cases where it makes everything simpler.
- bmacho 7mo agotar supports that types of concatenation, so you can concatenate tar.gz files, and unpack them all into separate files
- sedatk 7mo agoI know, but I've been always confused why a gzip file would have a filename field in its header if it's supposed to contain only one file. Obviously it's good to keep a backup of original filename somewhere, but it's confusing nonetheless.