Popular Searches

download information for Search Optimization  Search Optimization
download information for Search Engine  Search Engine
download information for Adsense  Adsense
download information for RSS  RSS
download information for Blog  Blog
download information for Compression  Compression
download information for Audio  Audio
download information for Video  Video
download information for XML  XML
download information for Screensaver  Screensaver
download information for CSS  CSS
download information for Backup  Backup
download information for Software  Software
download information for Spyware  Spyware



Tags

computing derived archive format bitstream program handle posix1 initially developed backup sequential access devices purposes commonly collate larger archiving preserving



Web Matches



A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z

Search Articles e.g. mp4
 

Tar (file format)

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 the program used to handle such files. The format was standardized by POSIX.1-1988 and later POSIX.1-2001. Initially developed as a raw format, used for tape backup and other sequential access devices for backup purposes, it is now frequently used to collate collections of files into one larger file, for distribution or archiving, while preserving file system information such as user and group permissions, dates, and directory structures.

Tar's linear roots can still be seen in its ability to work on any data stream and its slow partial extraction performance, as it has to read through the whole archive to extract only the final file. A Tar file (somefile.tar), when subsequently compressed using a compression utility such as gzip, bzip2, or (formerly) compress, produces a compressed Tar file with a filename extension signifying the type of compression (e.g.: somefile.tar.gz). A .tar file is frequently referred to as a Tarball, which is typically compressed to save disk space.

As is common with Unix utilities, Tar is a single specialist program. It follows the Unix philosophy in that it can "do only one thing" (archive), "but do it well". Tar is most frequently used in tandem with an external compression utility, since it has no built-in data compression facilities. These compression utilities typically only compress a single file, hence the pairing with Tar, that can produce a single file from many files. To ease this common usage, the BSD and GNU versions of Tar support the command line options -z (gzip), and -j (bzip2) which will compress or decompress the archive file it is currently working with, although even in this case the (de)compression is still actually performed by an external program.

Program examples

Some simple examples of using the Tar program.

To create a Tar file

Creates a GZIP-compressed Tar file of the name archive.tar.gz of all files with a .txt suffix.

To list files in a compressed Tar file

To extract files from a Tar file

Extracts all files from a compressed Tar file of the name archive.tar.gz.

To extract to a specific folder, use:

Format details

A Tar file is the concatenation of one or more files. Each file is preceded by a header block. 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 blocks.

A limitation of early tape drives was that data could only be written to them in 512 byte blocks . As a result data in Tar files is arranged in 512 byte blocks.

The Tar command can write data to tape in chunks of several 512 byte blocks, to minimize the wasted gaps in the tape between write operations. Each chunk is called a record. The user can specify a blocking factor, which is the number of blocks per record. The end of an archive gets padded with extra blocks of zeros to make its total size equal a multiple of records, regardless of whether tape is used as the storage medium.

File header

The file header block contains metadata about a file. To ensure portability across different architectures with different byte orderings, the information in the header block is encoded in ASCII.Thereforeif all the files in an archive are text files, then the archive is essentially an ASCII file.

The fields defined by the original Unix Tar format are listed in the table below. When a field is unused it is zero filled. The header is padded with zero bytes to make it up to a 512 byte block.

Field OffsetField SizeField
0

100

File name

100

8

File mode

108

8

Owner user ID

116

8

Group user ID

124

12

File size in bytes

136

12

Last modification time

148

8

Check sum for header block

156

1

Link indicator

157

100

Name of linked file


Numbers are encoded in octal, so if the filesize field contains 00000000367 the file is really 247(dec) bytes long.

The Link indicator field can have the following values:

ValueMeaning
'0'

Normal file

(ASCII NUL)

Normal file

'1'

Hard link

'2'

Symbolic link

'3'

Character special

'4'

Block special

'5'

Directory

'6'

FIFO

'7'

Contiguous file


A directory is also designated by having a trailing slash(/) in the name.

For historical reasons numerical values are encoded in as ASCII text octal numbers, with leading zeroes. The final character is either a null or a space.Thereforealthough there are 12 bytes reserved for storing the file size, only 11 octal digits can be stored. This gives a maximum file size of 8 gigabytes on archived files. To overcome this limitation some versions of Tar, including the GNU implementation, support an extension in which the file size is encoded in binary. Additionally, versions of GNU Tar from 1999 and before pad the values with space characters instead of zero characters.

The checksum is calculated by taking the sum of the byte values of the header block with the eight checksum bytes taken to be ascii spaces (value 32). It is stored as a six digit octal number with leading zeroes proceeded by a nul and then a space.

USTAR format

Most modern Tar programs read and write archives in the new USTAR (Uniform Standard Tape Archive) format, which has an extended header definition as defined by the POSIX (IEEE P1003.1) standards group. Older Tar programs will ignore the extra information, while newer programs will test for the presence of the "ustar" string to determine if the new format is in use. The USTAR format allows for longer file names and stores extra information about each file.

Field OffsetField SizeField
0

156

(as in old format)

156

1

Type flag

157

100

(as in old format)

257

6

USTAR indicator "ustar"

263

2

USTAR version "00"

265

32

Owner user name

297

32

Owner group name

329

8

Device major number

337

8

Device minor number

345

155

Filename prefix


Example

The example below shows the ASCII dump of a header block from a Tar file created using the GNU Tar program. It was dumped with the od program. The "ustar" magic string proceeded by two spaces can be seen, meaning that the Tar file is in GNU format, partially incompatible with the true USTAR standard (in POSIX.1-1988), which has the signature "ustar" proceeded by a NUL character.

Note, the OpenBSD 3.7 Tar does not have the 2 space characters after ustar. They are nul characters.

Note, GNU Tar by default creates incompatible archives in case that the archives contain path names that are longer than 100 characters and GNU Tar writes an incorrect size field in case a sparse file has more than 4 holes.

Naming of Tar archive files

Like most Unix utilities, Tar doesn't require any specific filename suffix in order to recognize a file as an archive. Conventionally, Tar archive files have names ending in ".tar". If an archive is compressed, the compression program adds its own suffix as usual, resulting in filename endings like ".tar.Z", ".tar.gz", and ".tar.bz2".

Names like those can't exist on MS-DOS due to its 8.3 filename boundaries, so a second set of conventions appeared for storing compressed Tar archives on an MS-DOS file system: ".taz" is equivalent to ".tar.Z", and ".tgz" is equivalent to ".tar.gz". These shortened filename suffixes are still occasionally used despite the nearly complete disappearance of the limited file systems which made them necessary. There also exists some shortened equivalents of ".tar.bz2" like ".tbz2" or ".tb2", but they were never widely used because bzip2 didn't rise to prominence until after MS-DOS had been mostly abandoned in favor of newer systems with less strict filename requirements.

Tarbombs

Not to be mixed up with decompression bomb.

Tarbomb is derogatory hacker slang used to refer to a Tarball containing files that untar to the current directory instead of untarring into a directory of their own. This can be a potential problem if it overwrites files using the same name in the current directory. It can also be a pain for the user who then needs to delete all the files that are scattered over the directory amongst other files. Often this ends up happening in the user's home directory. Such behaviour is often considered bad etiquette on the part of the archive's creator.

Tarpit

Tarpit is a term to describe a method of revision control where a Tar is used to capture the state of development of a software module at a specific point in time. The use of a Tarpit typically loosely mirrors the use of a revision control software tag and branching through the use of descriptive names.

Notes


This is to allow to read archives from Tar implementations from the 1970s (the byte 0x00 is ASCII NUL).
GNU Tar's headers mark this field as "Reserved"
Apparently relevant on an OS called RTU, this would be a normal file written in one contiguous section on-disc. GNU Tar's headers mark this field as 'Reserved', and such items will probably be extracted as normal files on other operating systems.



Related Ads



Add to Google Add to Yahoo Add to Furl  Add to del.icio.us  Add to DIGG

Resource: Part or all of the information provided in this section is brought to you via wikipedia and other similar sites. Please repsect their licenses and for more information visit the homepages of these sites.

Links
Freeware Downloads Download Information RGB Hex Converter Web Colors
Home  Link to Us
Copyright © iFreeware Downloads 2005-2012
All rights reserved