[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1 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(8). 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 to 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 catastrophic nature of these errors, GNU tar now takes some distance from elegance, and cowardly refuses to create an archive when ‘--create’ option is given, there are no arguments besides options, and ‘--files-from’ (‘-T’) 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’ 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 -cf empty-archive.tar -T /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-08-30’, while it used to show them as ‘Aug 30 1996’. Preferably, people should get used to ISO 8601 dates. Local American dates should be made available again with full date localization support, once ready. In the meantime, programs not being localizable for dates should prefer international dates, that's really the way to go.

Look up http://www.cl.cam.ac.uk/~mgk25/iso-time.html if you are curious, it contains a detailed explanation of the ISO 8601 standard.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Sergey Poznyakoff on October, 20 2013 using texi2html 1.78.