Normally, tar
writes extracted files into the file system without
regard to the files already on the system; i.e., files with the same
names as archive members are overwritten when the archive is extracted.
If the name of a corresponding file name is a symbolic link, the file
pointed to by the symbolic link will be overwritten instead of the
symbolic link itself (if this is possible). Moreover, special devices,
empty directories and even symbolic links are automatically removed if
they are found to be on the way of the proper extraction.
To prevent tar
from extracting an archive member from an archive
if doing so will overwrite a file in the file system, use
--keep-old-files (-k) in conjunction with `--extract'. When
this option is specified, tar
will report an error stating the
name of the files in conflict instead of overwriting the file with the
corresponding extracted archive member.
@FIXME{these two P's have problems. i don't understand what they're trying to talk about well enough to fix them; i may have just made them worse (in particular the first of the two). waiting to talk with hag.}
The --unlink-first (-U) option removes existing files, symbolic links, empty directories, devices, etc., prior to extracting over them. In particular, using this option will prevent replacing an already existing symbolic link by the name of an extracted file, since the link itself is removed prior to the extraction, rather than the file it points to. On some systems, the backing store for the executable is the original program text. You could use the --unlink-first (-U) option to prevent segmentation violations or other woes when extracting arbitrary executables over currently running copies. Note that if something goes wrong with the extraction and you did use this option, you might end up with no file at all. Without this option, if something goes wrong with the extraction, the existing file is not overwritten and preserved.
@FIXME{huh?} If you specify the --recursive-unlink option,
tar
removes anything that keeps you from extracting a file
as far as current permissions will allow it. This could include removal
of the contents of a full directory hierarchy. For example, someone
using this feature may be very surprised at the results when extracting
a directory entry from the archive. This option can be dangerous; be
very aware of what you are doing if you choose to use it.
Go to the first, previous, next, last section, table of contents.