During your tour of Linux file system, you probably noticed a strange kind of directory entry, particularly in the /boot and /lib directories. When listed with ls -l, you would have seen something like this:
lrwxrwxrwx 25 Jul 3 16:42 System.map -> /boot/System.map-2.0.36-3 -rw-r--r-- 105911 Oct 13 1998 System.map-2.0.36-0.7 -rw-r--r-- 105935 Dec 29 1998 System.map-2.0.36-3 -rw-r--r-- 181986 Dec 11 1999 initrd-2.0.36-0.7.img -rw-r--r-- 182001 Dec 11 1999 initrd-2.0.36.img lrwxrwxrwx 26 Jul 3 16:42 module-info -> /boot/module-info-2.0.36-3 -rw-r--r-- 11773 Oct 13 1998 module-info-2.0.36-0.7 -rw-r--r-- 11773 Dec 29 1998 module-info-2.0.36-3 lrwxrwxrwx 16 Dec 11 1999 vmlinuz -> vmlinuz-2.0.36-3 -rw-r--r-- 454325 Oct 13 1998 vmlinuz-2.0.36-0.7 -rw-r--r-- 454434 Dec 29 1998 vmlinuz-2.0.36-3
Notice the files, System.map, module-info and vmlinuz. See the strange notation after the file names?
These three files are called symbolic links. Symbolic links are a special type of file that point to another file. With symbolic links, it is possible for a single file to have multiple names. Here’s how it works: Whenever the system is given a file name that is a symbolic link, it transparently maps it to the file it is pointing to.
Just what is this good for? This is a very handy feature. Let’s consider the directory listing above (which is the /boot directory of an old Red Hat 5.2 system). This system has had multiple versions of the Linux kernel installed. We can see this from the files vmlinuz-2.0.36-0.7 and vmlinuz-2.0.36-3. These file names suggest that both version 2.0.36-0.7 and 2.0.36-3 are installed. Because the file names contain the version it is easy to see the differences in the directory listing. However, this would be confusing to programs that rely on a fixed name for the kernel file. These programs might expect the kernel to simply be called "vmlinuz". Here is where the beauty of the symbolic link comes in. By creating a symbolic link called vmlinuz that points to vmlinuz-2.0.36-3, we have solved the problem.