Anne
2 min readOct 11, 2016

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

the Hollywood analogy

Norma Jean is Marylin is Sugar Kane

First I will explain links through the many names of Marylin Monroe before being more technical.

At first, there was Norma Jean. Some girl. She decided to star in movies as Marilyn. But they were the same person. If Marilyn drank too much one night, Norma would get a hangover the morning after. We could say there is a hard link between Marilyn and Norma Jean. There are some distinctions with computing, but the basic principle is this one. It is the same.

Marilyn starred in movies such as Some Like it Hot where she is called Sugar. The movie credits say Sugar is interpreted by Marilyn. Sugar is a soft link to Marilyn. It points, names Marilyn in the movie. But when Marilyn moves on, it will be over, and if there is a remake it will point to another actress.

In computing, and in our context bash. We create links with the command ln, by default these are hard links, if we use the -s option as in ln -s we create symbolic links. The screen capture of the shell displays all that.

First we created 2 files Marilyn and Monroe, made a hard link between Marilyn and Norma and a soft link between Monroe and Sugar. Works fine, displays the same interesting stuff.

We see that if we rename or move the files Marilyn and Monroe, the hard link Norma follows along when Sugar gets lost. And if we modify the hard link, the original file is modified as well.

What happens under the hood is that the actual data resides somewhere in the hard drive. When we create a file, our file name makes a link to that data. When we create a hard link, we create another direct link to that data whereas when we create a soft link we only make a link with the file name as it and where it is. So the soft link is indirect and can be left dangling if the file name is moved while even if we destructed Marilyn, we would still keep all our data as Norma the hard link would still be there. We would have to remove Norma as well to lose it all. But that is true in computers life only.