Tar

 [image of the Head of a GNU]


Table of Contents


Introduction to Tar

The Tar program provides the ability to create tar archives, as well as various other kinds of manipulation. For example, you can use Tar on previously created archives to extract files, to store additional files, or to update or list files which were already stored.

Initially, tar archives were used to store files conveniently on magnetic tape. The name "Tar" comes from this use; it stands for tape archiver. Despite the utility's name, Tar can direct its output to available devices, files, or other programs (using pipes), it can even access remote devices or files (as archives).

Additional information about the project, including links to the project development page and file downloads, is available from the GNU software directory.

Downloading Tar

Stable versions of GNU Tar can be found on in the subdirectory /gnu/tar/ on your favorite GNU mirror. For other ways to obtain Tar, please read How to get GNU Software

Latest intermediate snapshots are available from tar snapshot ftp. Alpha releases are distributed from alpha.gnu.org.

For information about CVS access, alpha releases, patches, etc., please see the project's home page.

Manual

GNU Tar is fully documented. Complete documentation in Texinfo format is included in the distribution. An online manual is available in various formats.

Mailing lists

If you wish to send a bug report, a feature request, or simply to share your thoughts about GNU tar, please write to <bug-tar@gnu.org>. Notice, that this is a moderated list, i.e. postings from non-subscribers are held until one of moderators has time to approve them. To subscribe to the list, visit http://mail.gnu.org/mailman/listinfo/bug-tar.

Releases

Date Version Download (please use one of the mirrors instead) Information
2011-03-13 1.26 shar.gz; signature.
tar.gz; signature.
tar.bz2; signature.
tar.xz; signature.
cpio.gz; signature.
Bugfixes
  • Fix the --verify option, which broke in version 1.24.
  • Fix storing long sparse file names in PAX archives.
  • Fix correctness of --atime-preserve=replace.
  • Work around POSIX incompatibilities on FreeBSD, NetBSD and Tru64.
  • Fix bug with --one-file-system --listed-incremental.
2010-11-07 1.25 shar.gz; signature.
tar.gz; signature.
tar.bz2; signature.
tar.xz; signature.
cpio.gz; signature.
Bugfixes
  • Fix extraction of empty directories with the -C option in effect
  • Fix extraction of device nodes
  • Make sure name matching occurs before eventual name transformation
  • Fix the behavior of tar -x --overwrite on hosts lacking O_NOFOLLOW.
  • Improve the testsuite
Alternative decompression programs

If extraction from a compressed archive fails because the corresponding compression program is not installed and the following two conditions are met, tar retries extraction using an alternative decompressor:

  1. Another compression program supported by tar is able to handle this compression format
  2. The compression program was not explicitly requested in the command line by the use of such options as -z, -j, etc.

For example, if compress is not available, tar will try gzip.

2010-10-24 1.24 shar.gz; signature.
tar.gz; signature.
tar.bz2; signature.
tar.xz; signature.
cpio.gz; signature.

See the NEWS file, for a detailed information.

  • The --full-time option
  • More reliable directory traversal when creating archives
  • --dereference consistency
  • Extracts symlink attributes, such as last-modified time and link permissions, if the operating system supports this
  • Fixed spurious error diagnostics on broken pipe
  • Fixed --remove-files bug (previous version would fail to remove a directory which contained symlinks to another files within that directory)
  • Accepts the --label option used together with --update
  • The options --record-size and --tape-length (-L) accept size suffixes
  • Fixed dead loop on extracting existing symlinks with the -k option
2010-03-10 1.23 Gzipped shell archive and its signature.
Gzipped tar archive and its signature.
Bzipped tar archive and its signature.
Gzipped cpio archive and its signature.

See the NEWS file, for a detailed information.

  • Improved record size autodetection
  • Use of lseek on seekable archives
  • New command line option --warning
  • New command line option --level
  • Improved behavior if some files were removed during incremental dumps
  • Modification times of PAX extended headers
  • Time references in the --pax-option argument
  • Augmented environment of the --to-command script
  • Bugfixes:
    • Fix handling of hard link targets by -c --transform
    • Fix hard links recognition with -c --remove-files
    • Fix restoring files from backup (debian bug #508199)
    • Correctly restore modes and permissions on existing directories
    • The --remove-files option removes files only if they were succesfully stored in the archive
    • Fix storing and listing of the volume labels in POSIX format
    • Improve algorithm for splitting long file names (ustar format)
    • Fix possible memory overflow in the rmt client code (CVE-2010-0624)
2009-03-05 1.22 Gzipped shell archive and its signature.
Gzipped tar archive and its signature.
Bzipped tar archive and its signature.
Gzipped cpio archive and its signature.
  • Support for xz compression (--xz option)
  • Short option -J is reassigned as a shortcut for --xz
  • The option -I is a shortcut for --use-compress-program
  • The --no-recursive option works with --incremental
2008-12-27 1.21 Gzipped shell archive and its signature.
Gzipped tar archive and its signature.
Bzipped tar archive and its signature.
Gzipped cpio archive and its signature.
  • New short option -J, an alias for --lzma
  • New option --lzop
  • New option --no-auto-compress,

    Cancels the effect of previous --auto-compress (-a) option

  • New option --no-null

    Cancels the effect of previous --null option.

  • Compressed format recognition

    If tar is unable to determine archive compression format, it falls back to using archive suffix to determine it.

  • VCS support

    Using --exclude-vcs handles also files used internally by Bazaar, Mercurial and Darcs.

  • Transformation scope flags

    Name transformation expressions understand additional flags that control type of archive members affected by them. The flags are:

    r
    Apply transformation to regular archive members.
    s
    Apply transformation to symbolic link targets.
    h
    Apply transformation to hard link targets.

    The corresponding upper-case letters negate the meaning, so that H means do not apply transformation to hard link targets.

    The scope flags are listed in the third part of a s expression, e.g.:

    $ tar --transform 's|^|/usr/local/|S'
              

    The default is rsh, which means that transformations are applied to both regular archive members and to the targets of symbolic and hard links.

    If several transform expressions are used, the default flags can be changed using flags= statement placed before the expressions, e.g.:

    $ tar --transform 'flags=S;s|^|/usr/local/|'
              
  • Bugfixes:
    1. The --null option disabled handling of tar options in list files. This is fixed.
    2. Fixed record size autodetection. If detected record size differs from the expected value (either default, or set on the command line), tar prints a warning if verbosity level is set to 1 or greater, i.e. if either -t or -v option is given.
2008-04-14 1.20 Gzipped shell archive and its signature.
Gzipped tar archive and its signature.
Bzipped tar archive and its signature.
Gzipped cpio archive and its signature.
  • New option --auto-compress (-a)

    With --create, selects compression algorithm basing on the suffix of the archive file name.

  • New option --lzma

    Selects LZMA compression algorithm.

  • New option --hard-dereference

    During archive creation, dereferences hard links and stores the files they refer to, instead of creating usual hard link members (type '1').

  • New option --checkpoint-action

    This action allows to specify an action to be executed upon hitting a checkpoint. Recognized actions are: dot, echo (the default), echo=string, ttyout=string, exec=cmdline, and sleep=value. Any number of --checkpoint-action options can be specified, the actions will be executed in order of their appearance in the command line. See section 3.8 "Checkpoints" for a complete description.

  • New options --no-check-device, --check-device.

    The --no-check-device option disables comparing device numbers during preparatory stage of an incremental dump. This allows to avoid creating full dumps if the device numbers change (e.g. when using an LVM snapshot).

    The --check-device option enables comparing device numbers. This is the default. This option is provided to undo the effect of the previous --no-check-device option, e.g. if it was set in TAR_OPTIONS environment variable.

  • The --transform option.

    Any number of --transform options can be given in the command line. The specified transformations will be applied in turn.

    Argument to --transform option can be a list of replace expressions, separated by a semicolon (as in sed).

    Filename transformations are applied to symbolic link targets during both creation and extraction. Tar 1.19 used them only during extraction.

    For a detailed description, see section 6.7 "Modifying File and Member Names".

  • Info (end-of-volume) scripts

    The value of the blocking factor is made available to info and checkpoint scripts via environment variable TAR_BLOCKING_FACTOR.

  • Incremental archives

    Improved (sped up) extracting from incremental archives.

  • Bugfixes.
    • Fix bug introduced in version 1.19: tar refused to update non-existing archives.
2007-10-10 1.19 Gzipped shell archive and its signature.
Gzipped tar archive and its signature.
Bzipped tar archive and its signature.
Gzipped cpio archive and its signature.
  • New option --exclude-vcs excludes directories and files, created by several widely used version control systems, e.g. CVS/, .svn/, etc.
  • The --exclude-tag* and --exclude-cache* option families work with incremental archives as well.
  • Fixed handling of renamed files in listed incremental archives.

    Previous versions always stored absolute file names in rename records, even if -P was not used. This is fixed: rename records contain file names processed in accordance with the command line settings.

  • Fixed --version output.
  • Recognition of broken archives.

    When supplied an archive smaller than 512 bytes in reading mode (-x, -t), previous tar versions silently ignored it, exiting with code 0. It is fixed. Tar now issues the following diagnostic message: This does not look like a tar archive, and exits with code 2.

  • Fix double-dot recognition in archive member names in case of duplicate /..
  • Fix file padding in case of truncation of the input file to zero size.
2007-06-29 1.18 Gzipped shell archive and its signature.
Gzipped tar archive and its signature.
Bzipped tar archive and its signature.
Gzipped cpio archive and its signature.
  • Licensed under the GPLv3.
  • Several bugs in the testsuite are fixed.
2007-06-08 1.17 Gzipped shell archive and its signature.
Gzipped tar archive and its signature.
Bzipped tar archive and its signature.
Gzipped cpio archive and its signature.
  • Fix archivation of sparse files in posix mode. Previous versions padded sparse members with spurious zero blocks.
  • Fix operation of --verify --listed-incremental. Version 1.16.1 produced a full dump when both options were given.
  • Fix --occurence. In previous versions it continued scanning the archive even though all requested members has already been extracted.
  • Scope of --transform and --strip-components options.

    In addition to affecting regular archive members, the --transform option affects hard and symbolic link targets and the --strip-components option affects hard link targets as well.

  • End-of-volume script can send the new volume name to tar by writing it to the file descriptor stored in the environment variable TAR_FD (instead of hard-coded descriptor number used in previous versions).
2006-12-09 1.16.1 Gzipped shell archive and its signature.
Gzipped tar archive and its signature.
Bzipped tar archive and its signature.
Gzipped cpio archive and its signature.
  • New option --exclude-tag allows to specify exclusion tag files, i.e. files whose presence in a directory means that the directory should not be archived.
  • The --exclude-cache option excludes directories that contain the CACHEDIR.TAG file from being archived. Previous versions excluded directory contents only, while the directories themselves were still added to the archive.
  • Support for reading ustar type N header logical records has been removed. This GNU extension was generated only by very old versions of GNU tar. Unfortunately its implementation had security holes. We don't expect that any tar archives in practical use have type N records, but if you have one and you trust its contents, you can decode it with GNU tar 1.16 or earlier.
  • Race conditions have been fixed that in some cases briefly allowed files extracted by tar -x --same-owner (or plain tar -x, when running as root) to be accessed by users that they shouldn't have been.
2006-10-21 1.16 Gzipped shell archive and its signature.
Gzipped tar archive and its signature.
Bzipped tar archive and its signature.
Gzipped cpio archive and its signature.
See NEWS file for the list of changes.
A cpio archive is provided for those who do not have tar or sharutils. To unpack it run: gzip -d -c tar-1.16.cpio.gz | cpio -i.
2006-06-16 1.15.91 Gzipped shell archive and its signature
Gzipped tar archive and its signature
Bzipped tar achive and its signature.

See announce.

2006-02-19 1.15.90 Gzipped shell archive and its signature
Gzipped tar archive and its signature
Bzipped tar achive and its signature.

Alpha release in preparation for next stable version. See its announce, for the detailed description of bug fixes and new features.

2004-12-21 1.15.1 Gzipped patch over the previous version and its signature.
Gzipped shell archive and its signature.
Gzipped tar archive and its signature.
Bzipped tar archive and its signature.

Unpacking archives piped from standard input now works correctly. This logic flaw was introduced in version 1.15 and has unfortunately passed unnoticed the pretesting phase.

If you have already downloaded version 1.15 of the package, you may wish downloading the patch, instead of getting the complete new tarball.

To apply the patch, change to the tar-1.15 directory and then use patch -p1. -p1 avoids guesswork in choosing which subdirectory to find each file in.

2004-12-20 1.15 Gzipped shell archive and its signature.
Gzipped tar archive and its signature.
Bzipped tar archive and its signature.
  • Compressed archives are recognised automatically, it is no longer necessary to specify -Z, -z, or -j options to read them. Thus, you can now run tar tf archive.tar.gz and expect it to work!
  • When restoring incremental dumps, --one-file-system option prevents directory hierarchies residing on different devices from being purged.
  • --strip-path option renamed to --strip-components.
  • Restore script starts restoring only if it is given --all (-a) option or some patterns. This prevents accidental restores.
  • tar --verify prints a warning if during archive creation some of the file names had their prefixes stripped off.
  • New option --exclude-caches instructs tar to exclude cache directories.
See NEWS for more detailed information.
2004-09-02 1.14.90 Gzipped shell archive
Gzipped tar archive
Bzipped tar archive
An alpha release fixing bugs found in version 1.14. See the list of user-visible changes and ChangeLog diff for detailed information.
2004-05-10 1.14 Gzipped shell archive
Gzipped tar archive
Bzipped tar archive
First major release since 1999. See NEWS, and ChangeLog for details.
Valid XHTML 1.0!