Next: Advanced tar, Up: 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
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 :-).
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 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 cfT empty-archive.tar /dev/null
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.
[1] This is well described in Unix-haters Handbook, by Simson Garfinkel, Daniel Weise & Steven Strassmann, IDG Books, ISBN 1-56884-203-1.