next up previous contents
Next: Job Control Up: Managing file links Previous: Hard links

Symbolic links

  Symbolic links are another type of link, which are somewhat different than hard links. A symbolic link allows you to give a file another name, but it doesn't link the file by inode.

The command ln -s will create a symbolic link to a file. For example, if we use the command

we will create the symbolic link bar pointing to the file foo. If we use ls -i, we will see that the two files have different inodes, indeed.

However, using ls -l, we see that the file bar is a symlink pointing to foo.

The permission bits on a symbolic link are not used (they always appear as rwxrwxrwx). Instead, the permissions on the symbolic link are determined by the permissions on the target of the symbolic link (in our example, the file foo).

Functionally, hard links and symbolic links are similar, but there are some differences. For one thing, you can create a symbolic link to a file which doesn't exist; the same is not true for hard links. Symbolic links are processed by the kernel differently than hard links are, which is just a technical difference but sometimes an important one. Symbolic links are helpful because they identify what file they point to; with hard links, there is no easy way to determine which files are linked to the same inode.

Links are used in many places on the Linux system. Symbolic links are especially important to the shared library images in /lib. See Section 4.7.2 for more information.    



Ross Biro
Tue May 23 13:39:28 PDT 1995