The libarchive(3) library can read GNU-format tar archives. It currently supports the most popular GNU extensions, including modern long filename and linkname support, as well as atime and ctime data. The libarchive library does not support sparse files, multi-volume archives, nor the old GNU long filename format.
The libarchive(3) library can read and write POSIX-compliant pax interchange format archives. Pax interchange format archives are an extension of the older ustar format that adds a separate entry with additional attributes stored as key/value pairs. The presence of this additional entry is the only difference between pax interchange format and the older ustar format. The extended attributes are of unlimited length and are stored as UTF-8 Unicode strings. Keywords defined in the standard are in all lowercase; vendors are allowed to define custom keys by preceding them with the vendor name in all uppercase. When writing pax archives, libarchive uses many of the SCHILY keys defined by Joerg Schillings "star" archiver. The libarchive library can read most of the SCHILY keys. It ignores any keywords that it does not understand.
The libarchive library can also write pax archives in which it attempts to suppress the extended attributes entry whenever possible. The result will be identical to a ustar archive unless the extended attributes entry is required to store a long file name, long linkname, extended ACL, file flags, or if any of the standard ustar data (user name, group name, UID, GID, etc) cannot be fully represented in the ustar header. In all cases, the result can be dearchived by any program that can read POSIX-compliant pax interchange format archives.
The libarchive library can both read and write this format. This format has the following limitations:
Device major and minor numbers are limited to 21 bits. Nodes with larger numbers will not be added to the archive.
Path names in the archive are limited to 255 bytes. (Shorter if there is no / character in exactly the right place.)
Symbolic links and hard links are stored in the archive with the name of the referenced file. This name is limited to 100 bytes.
Extended attributes, file flags, and other extended security information cannot be stored.
Archive entries are limited to 2 gigabytes in size.
Note that the pax interchange format has none of these restrictions.
The libarchive library can also read a variety of commonly-used extensions to the basic tar format. In particular, it supports base-256 values in certain numeric fields. This essentially removes the limitations on file size, modification time, and device numbers.
The first tar program appeared in Sixth Edition Unix (circa 1976). This makes the tar format one of the oldest and most widely-supported archive formats. The first official standard for the tar file format was the "ustar" (Unix Standard Tar) format defined by POSIX in 1988. POSIX.1-2001 extended the ustar format to create the "pax interchange" format. There have also been many custom variations.
The libarchive library can read both big-endian and little-endian variants of the original binary cpio format. This format used 32-bit binary values for file size and mtime, and 16-bit binary values for the other fields.
The libarchive library can both read and write this POSIX-standard format. This format stores the header contents as octal values in ASCII. It is standard, portable, and immune from byte-order confusion. File sizes and mtime are limited to 33 bits (8GB file size), other fields are limited to 18 bits.
The libarchive library can read both CRC and non-CRC variants of this format. The SVR4 format uses eight-digit hexadecimal values for all header fields. This limits file size to 4GB, and also limits the mtime and other fields to 32 bits. The SVR4 format can optionally include a CRC of the file contents, although libarchive does not currently verify this CRC.
Cpio is an old format that was widely used because of its simplicity and its support for very long filenames. Unfortunately, it has many limitations that make it unsuitable for widespread use. Only the POSIX format permits files over 4GB, and its 18-bit limit for most other fields makes it unsuitable for modern systems. In addition, cpio formats only store numeric UID/GID values (not usernames and group names), which can make it very difficult to correctly transfer archives across systems. Finally, there is no good way to extend the format, which means that ACLs, file flags, character encoding information, and non-standard file types can not be added except by breaking compatibility with existing implementations.
The traditional shar format uses a limited set of POSIX commands, including echo(1), mkdir(1), and sed(1). It is suitable for portably archiving small collections of plain text files. However, it is not generally well-suited for large archives (many implementations of sh(1) have limits on the size of a script) nor should it be used with non-text files.
This format is similar to shar but encodes files using uuencode(1) so that the result will be a plain text file regardless of the file contents. It also includes additional shell commands that attempt to reproduce as many file attributes as possible, including owner, mode, and flags. The additional commands used to restore file attributes make shardump archives less portable than plain shar archives.