The difference between hard and symbolic links

Paul Manot
2 min readSep 14, 2020
a hardrive

Files exist at a precise location in memory. Let’s say a piece of software on your computer needs to access a certain file. In order to do this it will first need to find a reference to that file. That’s where links come in handy.

You find 2 sorts of links, Hard and Symbolic (some times called Soft). They serve the same purpose, i.e referencing a file, but they do it in a different manner. Note, that Hard links are more ancient than Symbolic links and are seldom used in modern Unix machines.

Hard links have 2 main limitations:

  • they can’t reference directory
  • they can’t reference a file that is not on the same disk partition

On the other hand symbolic links don’t have these limitations:

  • they can reference both files and directories
  • They can reference a file or directory on another partition

Also a Hard link contains all of the original data of the file it is referencing. Therefor in order to destroy a file completely you need to destroy all hard links associated to it. As long as there still a hard link the original space in memory where the information leaves won’t be freed. Soft links are just pointers to the original file or directory. therefor if the original file or directory is deleted all links are broken and the deletion is final.

--

--