Next: hard links, Previous: Portable Names, Up: Portability [Contents][Index]

#### 8.3.2 Symbolic Links

Normally, when `tar` archives a symbolic link, it writes a block to the archive naming the target of the link. In that way, the `tar` archive is a faithful record of the file system contents. When `--dereference` (`-h`) is used with `--create` (`-c`), `tar` archives the files symbolic links point to, instead of the links themselves.

When creating portable archives, use `--dereference` (`-h`): some systems do not support symbolic links, and moreover, your distribution might be unusable if it contains unresolved symbolic links.

When reading from an archive, the `--dereference` (`-h`) option causes `tar` to follow an already-existing symbolic link when `tar` writes or reads a file named in the archive. Ordinarily, `tar` does not follow such a link, though it may remove the link before writing a new file. See Dealing with Old Files.

The `--dereference` option is unsafe if an untrusted user can modify directories while `tar` is running. See Security.