What is TAR?
Complete guide to the TAR file format
Last updated:
What is TAR?
TAR (Tape Archive) is a file packaging format originating from Unix in the late 1970s. The name refers to its original purpose: archiving files to magnetic tape drives for backup. TAR bundles multiple files and directories into a single archive file while preserving file system metadata including file permissions, ownership, timestamps, hard links, and symbolic links - attributes that are essential in Unix and Linux environments but which ZIP archives do not reliably preserve.
A plain TAR file does not compress data - it only bundles files together, similar to how you might rubber-band a stack of papers. Compression is applied on top of the TAR archive using separate tools: gzip creates .tar.gz, bzip2 creates .tar.bz2, and xz creates .tar.xz. This separation of concerns (packaging vs. compression) is a Unix design philosophy. TAR archives are the universal distribution format for Linux software source code and system backups.
How TAR Works
A TAR archive is a flat concatenation of records: each archived file is preceded by a 512-byte header block describing its name, size, permissions, and ownership, followed by the file's contents padded to a multiple of 512 bytes.[2] Because there is no central index, tar streams sequentially, which suits its tape origins but means readers must scan the whole archive to list or extract a specific member.[3] The archive ends with two consecutive zero-filled blocks marking end-of-file.[2]
History and Standardization
tar first appeared in Version 7 Unix in 1979 and was later standardized by POSIX, producing the ustar format that most modern tools read.[1] Because the original 512-byte header limited field sizes, extensions such as GNU tar and POSIX pax were introduced to support long file names, large files, and extended attributes beyond the historic limits.[2] These competing extensions mean a few exotic archives may not be fully portable between every implementation.[3]
Technical Details
TAR vs Other Archive Formats
| Feature | TAR | ZIP |
|---|---|---|
| Role | Bundling only[3] | Bundle + compress |
| Built-in compression | None[1] | DEFLATE |
| Unix metadata | Preserved[2] | Limited |
| Per-file access | Sequential | Random |
| Best for | Unix archiving pipelines | Cross-platform sharing |
TAR only bundles files and is usually paired with gzip or xz, whereas ZIP bundles and compresses in a single step.
Pros and Cons
Advantages
Preserves file permissions, ownership, and symbolic links that are lost in ZIP and other Windows-centric formats.
The tar command is installed on every Unix, Linux, and macOS system by default.
TAR archives can be streamed directly through pipes, enabling network backup and compression without temporary files.
Pair with any compression tool (gzip, bzip2, xz, zstd) to get the exact speed-to-compression trade-off you need.
Disadvantages
A plain .tar file is often larger than the original files because it adds header overhead without reducing data size.
Extracting a single file from a TAR archive requires reading through the entire archive sequentially.
TAR is not natively supported on Windows outside of WSL and PowerShell, requiring third-party tools like 7-Zip.
Appending to a TAR archive adds duplicate entries for updated files rather than replacing them, which can cause confusion.
When to Use TAR
Here are the most common situations where TAR is the right choice:
Linux Software Distribution
Open-source software releases are distributed as tar.gz or tar.xz source packages for compilation.
System Backup
Use tar to create complete backups of Linux filesystem directories including all permissions and ownership metadata.
Docker Image Exports
Docker exports container images as TAR archives using docker save.
Data Transfer Between Unix Systems
TAR is the standard way to package files for transfer between Unix/Linux systems without losing filesystem attributes.
Convert TAR Files
Need to convert your TAR files? Use our free online converter.
Try Archive Converter FreeFrequently Asked Questions about TAR
Does TAR compress files?
No. A plain TAR file does not compress data - it only bundles files together. To compress, combine TAR with gzip (tar.gz), bzip2 (tar.bz2), or xz (tar.xz).
How do I create a tar.gz file?
Use: tar -czf archive.tar.gz directory/ - The -c flag creates, -z applies gzip compression, and -f specifies the output filename.
How do I extract a TAR file?
Use: tar -xf archive.tar - For compressed variants: tar -xzf archive.tar.gz (gzip) or tar -xJf archive.tar.xz (xz).
Can I open TAR files on Windows?
7-Zip, WinRAR, and the built-in Windows 11 tar command can open TAR files on Windows. The Windows Subsystem for Linux (WSL) also provides native tar support.
What is the difference between TAR and ZIP?
TAR is a packaging format from Unix that preserves file permissions and metadata; ZIP is a combined packaging and compression format from Windows. TAR is compressed separately; ZIP compresses each file individually. TAR is standard on Linux; ZIP is standard on Windows.