| previous | contents | up | next |
A link is just such a stand-in. There are two types of
links. A symbolic link is a file that contains only information
about other files. Whenever a program tries to open a symbolic link,
the operating system examines the link, finds the target file, and
opens the target instead. Because the link is a separate file,
you can see both the link and the target in a directory listing.
ls -l shows a link as a normal file followed by
an ASCII arrow (->) . On the right side of the arrow is
the paths to the target file.
To make a symbolic link, use the command ln as follows:
ln -s target_name link_nameWhen you rm link_name, you are deleting the link itself, not the target. Be careful, however: rm -r link_name will remove the target, not the link, if the target is a directory.
-s option. The problem with hard
links is that, by their nature, they cannot be seen with ls -l.
Once a hard link is made, the operating system has no way to distinguish the
link from the original file. Using rm on a hard link will
remove the link, but leave the files's contents reachable through
the file entry, just as with symbolic links--but using rm on
the original file will also leave the file's contents reachable, this
time through the link. Furthermore, it is not possible to make a hard
link to a directory. For these reasons, hard links are
seldom used.
| previous | contents | up | next |