Christopher Sawtell wrote:
[snip]
I think your misunderstanding is about he use of the word 'link'.
Understandably, because in English the word means 'join two things', whereas in Unix-speak it means 'create an alias'.
Thus to create a directory called with an upper-case letter name and a link with a lower-letter one would do the following:
[EMAIL PROTECTED] ~/tmp $ mkdir Z # to make the directory [EMAIL PROTECTED] ~/tmp $ ln -s Z z # to create the link or alias [EMAIL PROTECTED] ~/tmp $ ls -l total 0 drwxr-xr-x 2 chris users 6 Mar 21 08:16 Z lrwxrwxrwx 1 chris users 1 Mar 21 08:16 z -> Z
Note that you do _not_ create two directories and then link them together.
[snip]
It gets worse...
link and unlink are a very fundamental concept in unix. When you start programming in C ( as I'm sure you all will! ), you'll scratch your head looking for a delete function, to remove a file. It's called unlink. Why???
As far as the computer's concerned, files are identified by a number ( called the inode number ) that's unique within a mounted partition. Names are just for us stoopid users. We users can create as many *links* to a file as we like. All just point to the same inode number. So the deletion process for a file is made more complex. You always have to remove the directory entry, and *only if* this is the last link to the inode number, do you remove the file.
This also makes the ln command one that can really throw you. You have to links to a file, and you delete one of them, and then update the file. You usually expect to see the changes reflected in all the links, but that's not always true. See the example below.
steve> echo hello > aa steve> ln aa bb steve> cat bb hello steve> echo bye > bb steve> cat aa bye steve> rm bb rm: remove regular file `bb'? y steve> echo hello > bb steve> cat aa bye steve> cat bb hello
So, hard linked files can get out of step easily. This is where symbolic links come in. These are a pointer from one file to another. Apart from addressing the really quirky problem above, they have two distinct advantages: they can point to files on other partitions, and they can point to directories. They're a lot slower, but, to be honest, the time when that *really* mattered has passed.
Recommendation: use ln with care - ln -s will more often do what you expect.
You can wake up at the back now.
Steve
