The Difference Between a Hard Link and a Symbolic Link

A Hard Link vs a Shadow Link

What is the difference between a hard link and a symbolic link in computer software? Simply they are both files that point towards another file to give the file multiple names it can be opened by. They are both created in Linux using the ln command. Used without options the ln command will create a hard link to a file. For example if I had a file named “couch” and I wanted to create a hard link titled “potato” I’d use the ln command like this:

ln couch potato

This would then create a hard link file called “potato”. So, if somebody was to try to open the file “potato” it would open up the file “couch” since the two are linked together. To make that same link, but instead make it symbolic you would simply add the “-s” flag to the command ln. Like this:

ln -s couch potato

By making the link symbolic the two files “couch” and “potato” don’t have to be kept on the same memory. Say, you put the file “couch” on a CD, you could still access it with the symbolic link “potato” even if “potato” was on the computers hard drive. This, however doesn’t work with hard links.

Another benefit to symbolic links is that they can be created even without a file to link to, and be linked later. Whereas, a hard link must have a file to link to when it is created.

That’s the basic of symbolic and hard links. From how to create them to some key differences between the two.