Like when you send a .7z instead of a .zip or .rar to a friend or a teacher because that’s what your computer has installed and they’re like “Oh No, not one of those, now I have to install 7Zip” even though the same program that opens .rar also opens .7z I feel like people are way more annoyed when they receive a .7z

  • Max-P@lemmy.max-p.me
    link
    fedilink
    arrow-up
    18
    ·
    edit-2
    1 year ago

    A few features of how tar archives work:

    • Compression is completely independent of the file bundling process, so it’s easy to recompress or convert without potential loss of information.
    • Compression works on the whole archive, so it can achieve better compression ratios if you’re compressing a bunch of text files as it just sees it as one big file
    • tar archives are streamable: you can decompress and extract the files live as they’re being downloaded, or uploaded.
    • tar archives can preserve permissions and user/group association, although that’s only really relevant on Linux/macOS/*BSD.
    • You can copy them easily to tape drives
    • It’s all open standards that are widely supported by most software, so unlike a rar or 7z, you’re pretty sure people will be able to extract those no matter what OS they use.

    Fun examples of how this can all come together:

    • Download a file from the Internet with curl, pipe it into the decompressor on my computer and then pipe to a Raspberry Pi over SSH and then pipe it into tar to extract it directly on it without ever needing an intermediate step as the target device have barely enough space on it to fit all the files.
    • Clone a computer: tar up the whole drive, pipe that over the network to a better computer which compresses it, then pipes it to both a hard drive for archival and then split it to send it to multiple computers who will decompress and extract it to their own hard drive, and voilà you have 5 clones of the computer and a backup copy of what you just did with zero intermediate steps slowing the process down.

    In practice, you double click your .tar.gz and it opens in your preferred archiver and it’s no different than a zip file.

    It is rather useful to be able to do all of that on the fly though, especially when you’re shipping GBs and you may not have enough space to store both the original files and the archive you’re creating.