[UFO Chicago] hard links vs soft links

Neil R. Ormos ormos at ripco.com
Fri Aug 13 10:16:46 PDT 2010

Jesse Becker wrote:
> [Brian Sobolak <brian at planetshwoop.com> wrote:]

>> So I ask you -- what good are hard  links for?

> A hard link, on the other hand, is more like this:

>   inode --\
>                >--> data
>   inode --/

A clarification: plural hard links to the same
file reference a single inode.

You can demonstrate this easily:

   ls -lid foo1 foo2
   # make sure foo1 and foo2 do not already exist

   echo 'test' > foo1
   # create foo1 of non-zero length

   ls -lid foo1 foo2
   # observe that foo1 exists and is linked once

   ln foo1 foo2       # create a new hard link (foo2)

   ls -lid foo1 foo2

   # observe that both foo1 and foo2 exist,
   # referencing the same inode,
   # and that the the link count has increased to 2

More information about the ufo mailing list