ln - Hard and Symbolic links

Hard Link:

ln data00 data99

The name data99 now refers to the same internal file as data00. Data99 is not
a copy of data00...just a different name for the same file. If data00 is
removed, data99 remains and all the data originally named data00 is still
there under the name data00. Unix removes the internal file once all hard
links to the file are removed.

Symbolic Link:

ln -s data00 data99

The name data99 now refers to the same internal file as data00. Data99 is not
a copy of data00 but a symbolic link to data00. If data00 is removed, data99
remains, but the true data file is deleted. This is somewhat like shortcuts
in Windows.

The important difference b/w a hard link (ln) and a symbolic link (ln -s) is:

  1. You can't make a hard-link to a directory.
  2. Hard links cannot cross disk partitions.
  3. You can't make a hard link to a file in a network file system
  4. Permission modes on symbolic links are meaningless.

Hard links must refer to a real file, symbolic links may point to a file
or directory that doesn't exist. As a result, commands like $ls and $cat
may print potentially confusing error messages:

  $ls
  paper.txt
  $cat paper.txt
  cat: paper.txt not found

ls points to the symbolic link which is there, cat looks for the real file
in which the symbolic link points, which is not there.