Make your own free website on
last updated on Dec 18 2002

$ ln -s existing new

I don't remember where this scrible came from.  I've had it for a while (rh5.2?).

Files are identified by the system by thier inode number, which is a unique file system identifier for the file.

The following will display the inode numbers and corresponding files in a directory.
    $ ls -i

A directory listing is actually a listing of inode numbers with thier corresponding filenames.
Each filename has a link to a particular inode.
You can have more than one filename pointing to the same inode.

Hard links

Two completely different filenames pointing to the same inode.  If you modify one, you are modifing both.  If you delete one, the other is still there.  Hard links must be on the same filesystem.

Symbolic links

Does not link the file by inode.  Links by filename.  must use across different partitions.
File permission on a symbolic link are detemined by the target file.

lets say you have two partitions.  one mounted on / and the other mounted on /usr.  (remember this is just an example)
Now you want to add a directory off / called opt but there is not enough space on / to add the file you want.
We can create a directory in /usr, which has lots of free space ;-), called /usr/opt.  The problem is we want it to look like it is accually in the root partition(/opt)  So we can make a symbolic link from /opt to /usr/opt.  When someone does a "cd /opt" they will actually go to /usr/opt.  Cool that is what we want.

First create the real directory.
    # mkdir /usr/opt

Now link /opt to /usr/opt
    # ln -s /usr/opt /opt

you should be ready to use /opt now.