RE: RE: Example of using 'ln'
Posted: 7/1/2003 1:17:45 PM
By: Comfortably Anonymous
Times Read: 2,774
0 Dislikes: 0
Topic: Linux
Parent Message
Although I am no expert in the subject, here is how I think of it (someone correct me if I am wrong): All files are essentially hard links, i.e. all files contain a link to an inode number that contains the data on the actual drive.  Use  ls -li  to view inode numbers... when you copy a file you create a brand new inode number and rewrite all of the data from the original filespace to the new one.  However, when you create a hard link you are simply duplicating the reference to the file's internal data.  So, when you deleted the original "test" file, you basically deleted one link to the inode.  However, the data still existed in the inode which is why the other hard links still funcitoned as they did prior.  I guess, then, that symbollic links function as links to links to data.  This way you can access the data pointed to by a symbolic link as you normally would with a file, but when you delete the original, you break the chain and the link ceases to function.  OK, now for some more fun  :)  Try creating a file, then creating a symbollic link to that file, and then creating a hard link to that symbollic link.  If you delete the symbollic link, the hard link continues to function, as you would expect.  However, if you delete the original file then the hard link becomes broken.  Seems to me like it's not a good idea to mix hard links and symbollic links because a hard link to a symbollic link turns out to be a symbollic link (?).
Rating: (You must be logged in to vote)