Symbolic v. hard links

Links are references to files, directories or memory locations

Links and what they link are created and specified through the ln command.

There are two types of links: hard and symbolic.

If we step back for a moment, we can think of a file having two parts:

1) a name; and

2) a reference to a memory address that holds the data that the name of the file is referring to

A hard link can be thought of just another “name” that refers to the same memory location. Hard links cannot reference directories, they must reference an existing file, and they may not reference a file outside of it’s own file system. The underlying data will not be “deleted” (unallocated by the kernel) until all hard links referencing the memory location are deleted.

A symbolic link is simply a pointer to a file or directory. The target need not exist at the time of creation, and if all symbolic links are deleted, there is no effect on the underlying data. If the target does not exist (has not been created yet or was deleted subsequent to symbolic link creation) the link will be “broken” but continue to exist.