link/symbolic link~ What is the differance?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Matt Alexander
Date:  
Subject: link/symbolic link~ What is the differance?
On Wed, 18 Dec 2002, Mike Starke wrote:

> /_> From what I've interpreted from a combination of the info/man pages on ln, it
> /_> seems that without the -s it is just another command for copy.
> /_>
> /_> Is this correct?
> /_
> /_With a hard link, you have pointers to the same data saved at some
> /_particular location on the disk. So it's technically not a copy.
> /_~M
> /_
> I must admit, I too, never fully understood the differance between
> soft & hard links.



As a test, create a file and then a hard link to it:

$ touch somefile
$ ln somefile somenewfile
$ ls -li some*

2763773 -rw-rw-r--    2 m        m          0 Dec 18 11:42 somefile
2763773 -rw-rw-r--    2 m        m          0 Dec 18 11:42 somenewfile


The first column is the inode number, which is the same for both files.
Next:

$ echo "blah blah" >> somefile
$ cat somenewfile
blah blah

Because hard linked files share the same inode, you can not make hard
links across filesystems, because each filesystem has it's own inode
numbers. Symlinks can be made across filesystems, however, since the
symlink has its own inode number.
~M

--
Your monitor is staring at you.