The typeflag byte at offset 156 of the
header says what kind of entry it
describes. It is a single ASCII character. Some flags describe a file system object;
others mark a header that carries extra information about the entry after it.
Entries
These flags describe a file, folder, link or device. Only regular files carry
data after the header; for the others size is zero.
| Flag | Entry | Description |
|---|---|---|
0 | Regular file | The data blocks after the header are the file’s contents. |
| NUL | Regular file | The same as 0, written by old tar programs. A name ending in / was a folder. |
1 | Hard link | Another name for a file stored earlier in the archive; linkname names it. |
2 | Symbolic link | linkname holds the link’s target. |
3 | Character device | devmajor and devminor give the device numbers. |
4 | Block device | As for a character device. |
5 | Directory | A folder. Its name ends with /. |
6 | FIFO | A named pipe. |
7 | Contiguous file | Reserved by POSIX for files stored in one piece. Readers treat it as a regular file. |
Extended headers
POSIX.1-2001 added two flags for headers whose data is a list of key and value records. See pax extensions.
| Flag | Header | Description |
|---|---|---|
x | Extended header | Records that apply to the next entry only, such as its full path or exact size. |
g | Global extended header | Records that apply to every following entry, until changed by another g header. |
GNU flags
POSIX leaves the capital letters A to Z for vendors. GNU
tar uses these. See GNU extensions.
| Flag | Header | Description |
|---|---|---|
L | Long name | Its data is the full name of the next entry. |
K | Long link name | Its data is the full link target of the next entry. |
S | Sparse file | A file with holes; only the parts holding data are stored. |
D | Dump directory | A folder in an incremental backup, with a list of the names it held. |
M | Multi-volume continuation | The rest of a file that began on the previous volume. |
V | Volume label | The archive’s label, held in name. It has no data. |
N | Old long name | An early GNU way of storing long names, no longer written. |
A reader that meets a flag it does not know is expected to treat the entry as a regular file. This is why an old program extracting a pax archive produces small extra files named after the pax headers.