Go to the first, previous, next, last section, table of contents.


Basic GNU tar Operations

The basic tar operations, --create (-c), --list (-t) and --extract (--get, -x), are currently presented and described in the tutorial chapter of this manual. This section provides some complementary notes for these operations.

--create (-c)
Creating an empty archive would have some kind of elegance. One can initialize an empty archive and later use --append (-r) for adding all members. Some applications would not welcome making an exception in the way of adding the first archive member. On the other hand, many people reported that it is dangerously too easy for tar to destroy a magnetic tape with an empty archive(5). The two most common errors are:
  1. Mistakingly using create instead of extract, when the intent was to extract the full contents of an archive. This error is likely: keys c and x are right next ot each other on the QWERTY keyboard. Instead of being unpacked, the archive then gets wholly destroyed. When users speak about exploding an archive, they usually mean something else :-).
  2. Forgetting the argument to file, when the intent was to create an archive with a single file in it. This error is likely because a tired user can easily add the f key to the cluster of option letters, by the mere force of habit, without realizing the full consequence of doing so. The usual consequence is that the single file, which was meant to be saved, is rather destroyed.
So, recognizing the likelihood and the catastrophical nature of these errors, GNU tar now takes some distance from elegance, and cowardly refuses to create an archive when --create (-c) option is given, there are no arguments besides options, and --files-from=file-of-names (-T file-of-names) option is not used. To get around the cautiousness of GNU tar and nevertheless create an archive with nothing in it, one may still use, as the value for the --files-from=file-of-names (-T file-of-names) option, a file with no names in it, as shown in the following commands:
tar --create --file=empty-archive.tar --files-from=/dev/null
tar cfT empty-archive.tar /dev/null
--extract (--get, -x)
A socket is stored, within a GNU tar archive, as a pipe.
--list (-t)
GNU tar now shows dates as `1996-11-09', while it used to show them as `Nov 11 1996'. (One can revert to the old behavior by defining USE_OLD_CTIME in `src/list.c' before reinstalling.) But preferrably, people you should get used to ISO 8601 dates. Local American dates should be made available again with full date localisation support, once ready. In the meantime, programs not being localisable for dates should prefer international dates, that's really the way to go. Look up http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html if you are curious, it contains a detailed explanation of the ISO 8601 standard.


Go to the first, previous, next, last section, table of contents.