tar: Basic tar
1
1 4.1 Basic GNU 'tar' Operations
1 ==============================
1
1 The basic 'tar' operations, '--create' ('-c'), '--list' ('-t') and
1 '--extract' ('--get', '-x'), are currently presented and described in
1 the tutorial chapter of this manual. This section provides some
1 complementary notes for these operations.
1
1 '--create'
1 '-c'
1
1 Creating an empty archive would have some kind of elegance. One
1 can initialize an empty archive and later use '--append' ('-r') for
1 adding all members. Some applications would not welcome making an
1 exception in the way of adding the first archive member. On the
1 other hand, many people reported that it is dangerously too easy
1 for 'tar' to destroy a magnetic tape with an empty archive(1). The
1 two most common errors are:
1
1 1. Mistakingly using 'create' instead of 'extract', when the
1 intent was to extract the full contents of an archive. This
1 error is likely: keys 'c' and 'x' are right next to each other
1 on the QWERTY keyboard. Instead of being unpacked, the
1 archive then gets wholly destroyed. When users speak about
1 "exploding" an archive, they usually mean something else :-).
1
1 2. Forgetting the argument to 'file', when the intent was to
1 create an archive with a single file in it. This error is
1 likely because a tired user can easily add the 'f' key to the
1 cluster of option letters, by the mere force of habit, without
1 realizing the full consequence of doing so. The usual
1 consequence is that the single file, which was meant to be
1 saved, is rather destroyed.
1
1 So, recognizing the likelihood and the catastrophic nature of these
1 errors, GNU 'tar' now takes some distance from elegance, and
1 cowardly refuses to create an archive when '--create' option is
1 given, there are no arguments besides options, and '--files-from'
1 ('-T') option is _not_ used. To get around the cautiousness of GNU
1 'tar' and nevertheless create an archive with nothing in it, one
1 may still use, as the value for the '--files-from' option, a file
1 with no names in it, as shown in the following commands:
1
1 tar --create --file=empty-archive.tar --files-from=/dev/null
1 tar -cf empty-archive.tar -T /dev/null
1
1 '--extract'
1 '--get'
1 '-x'
1
1 A socket is stored, within a GNU 'tar' archive, as a pipe.
1
1 '--list (-t)'
1
1 GNU 'tar' now shows dates as '1996-08-30', while it used to show
1 them as 'Aug 30 1996'. Preferably, people should get used to ISO
1 8601 dates. Local American dates should be made available again
1 with full date localization support, once ready. In the meantime,
1 programs not being localizable for dates should prefer
1 international dates, that's really the way to go.
1
1 Look up <http://www.cl.cam.ac.uk/~mgk25/iso-time.html> if you are
1 curious, it contains a detailed explanation of the ISO 8601
1 standard.
1
1 ---------- Footnotes ----------
1
1 (1) This is well described in 'Unix-haters Handbook', by Simson
1 Garfinkel, Daniel Weise & Steven Strassmann, IDG Books, ISBN
1 1-56884-203-1.
1