In computing, tar (derived from tape archive) is both a file format (in the form of a type of archive bitstream) and the name of a program used to handle such files. The format was created in the early days of Unix and standardized by POSIX.1-1988[citation needed] and later POSIX.1-2001[citation needed].
tar was initially developed to write data to sequential I/O devices for tape backup purposes. It is now commonly used to collect many files into one larger file for distribution or archiving, while preserving file system information such as user and group permissions, dates, and directory structures.
Naming of compressed tar files
tar archive files usually have the extension .tar, as in somefile.tar
. The pun, tarball,[6] is used to refer to a tar file.
A tar archive file contains uncompressed byte streams of the files which it contains. To achieve archive compression, a variety of compression programs are available, such asgzip, bzip2, xz, lzip, lzma, or compress, which compress the entire tar archive. Typically, the compressed form of the archive receives a filename by appending the format-specific compressor suffix to the archive file name. For example, a tar archive archive.tar, is named archive.tar.gz, when it is compressed by gzip.
Popular tar programs like the BSD and GNU versions of tar support the command line options Z (compress), z (gzip), and j (bzip2) to automatically compress or decompress the archive file upon creation or unpacking. GNU tar from version 1.20 onwards also supports --lzma
(LZMA). 1.21 also supports lzop via --lzop
, 1.22 adds support for xz via --xz
or -J
, and 1.23 adds support for lzip via --lzip
.
MS-DOS's 8.3 filename limitations, resulted in additional conventions for naming compressed tar archives. (This practice has declined with FAT offering long filenames.)
Short | Long |
---|---|
.tgz | .tar.gz |
.tbz , .tbz2 , & .tb2 | .tar.bz2 |
.taz | .tar.Z |
.tlz | .tar.lz |
.txz | .tar.xz |