18.104.22.168. Link types
Since we know more about files and their representation in the
file system, understanding links (or shortcuts) is a piece of cake.
A link is nothing more than a way of matching two or more file
names to the same set of file data. There are two ways to achieve
Hard link: Associate two or more file names with the same inode.
Hard links share the same data blocks on the hard disk, while they
continue to behave as independent files.
There is an immediate disadvantage: hard links can't span
partitions, because inode numbers are only unique within a given
Soft link or symbolic link (or for short: symlink): a small file
that is a pointer to another file. A symbolic link contains the
path to the target file instead of a physical location on the hard
disk. Since inodes are not used in this system, soft links can span
The two link types behave similar, but are not the same, as
illustrated in the scheme below:
Figure 3-2. Hard and soft link mechanism
Note that removing the target file for a symbolic link makes the
Each regular file is in principle a hardlink. Hardlinks can not
span across partitions, since they refer to inodes, and inode
numbers are only unique within a given partition.
It may be argued that there is a third kind of link, the
user-space link, which is similar to a shortcut in MS
Windows. These are files containing meta-data which can only be
interpreted by the graphical file manager. To the kernel and the
shell these are just normal files. They may end in a
.desktop or .lnk suffix; an example can be found
[[email protected] .gnome-desktop]$ cat La\ Maison\ Dupont
Name=La Maison Dupont
This example is from a KDE
[[email protected] Desktop]$ cat camera
Creating this kind of link is easy enough using the features of
your graphical environment. Should you need help, your system
documentation should be your first resort.
In the next section, we will study the creation of UNIX-style
symbolic links using the command line.