Wiston Venera Macías
2 min readSep 15, 2020

What is the difference between a hard link and a symbolic link?

Long story short, a symbolic link, or soft link for friends, is a shortcut that allows you quick access to an object for edit o manipulate its content. A hard link is a representation of the original object; that means using a hard link is like using the original object. You need to be sure about deleting a hard link because that operation will delete the file that your hard link is pointing to.

If we go deeper there are more differences. A symbolic link can be linked to any location, inclusive of a network location, but a hard link only can be linked-to files in the same filesystem. A hard link consumes less memory than a soft link and last but not least, they are created by different commands:

For hard links, we need to use “ln nameofthefile nameofthehardlink”.

For soft links ln -s nameofthefile nameofthehardlink” .

If you move or delete your original file or directory the soft link will stop working. But with the hard link, it’s the opposite; if you delete the pointing file the hard link will be working without problems. I forget it, a hard link can’t point to a directory because they break the filesystem, indeed, experts recommend using soft links instead of hard links, because soft links allow most of the same functionality but with no problems.

With the next picture, I’m going to give you a short example

An inode is an address where the data of a file is stored. For now, we can say that is the data in a computer language (ones and zeros). Let's say we have a soft link file called “Boring homework”, and that soft link is pointed to the next location “/home/myuser/videos/.special/Homework.mp4”. But also we have a hard link called “Emergency” pointed to the same location. If for any reason we need to delete our video without any trace, we can use rm Emergency and the hard link and the original file will be gone. But if we want to see our video later we can delete the soft link file Boring homework” and create again the soft link when we need it.