Gzip without tar? Why are they used together


Why are tar and gzip almost always used together, and not just gzip? Is there any advantage to that method?

Best Answer

TAR creates a single archived file out of many files, but does not compress them.

Format Details

A tar file is the concatenation of one or more files. Each file is preceded by a 512-byte header record. The file data is written unaltered except that its length is rounded up to a multiple of 512 bytes and the extra space is zero filled. The end of an archive is marked by at least two consecutive zero-filled records.

GZIP compresses a single file into another single file, but does not create archives.

File Format

...Although its file format also allows for multiple such streams to be concatenated (zipped files are simply decompressed concatenated as if they were originally one file), gzip is normally used to compress just single files.[4] Compressed archives are typically created by assembling collections of files into a single tar archive, and then compressing that archive with gzip.