Comparing Hard Links and Symbolic Links

“shallow focus photography of cyclone fence” by Nick van den Berg on Unsplash

A hard link is a file that contains the same data as another file because it points to the same information as another file although they may have different names and other properties. Hard links are really like two copies of a file except what you do to one copy happens to another. To illustrate, we can think of twins who claim to feel what the other feels or even siamese twins. If one feels what the other feels, but they are two distinct entities, in this case people, then they are hard linked. It is much easier to grasp this thinking about siamese twins. They may share a foot. What one feels in the foot will be felt by another. In addition, painting one’s foot blue makes the other’s foot blue as well. This could be useful when one file needs to be locally accessible by multiple programs. They can all hold one file in their directories, but the data is accessible and modifiable from all locations.

A symbolic link is more of a dispatcher. A symbolic link is a file that does not hold any data but rather points to another file and can route any requests toward the file it is linked to. It can be modified without affecting the original file. This is useful when multiple programs need to call a file, but the file is in only one location so multiple directories will have issue with calling the file, but they will be able to call the file with symbolic links. This provides flexibility of location for the file.

The difference between these two links is quite clear. One is a copy that causes changes to itself and its linked file, hard link, and one is a pointer that refers to another file, a symbolic link. They both connect to one central file, but their attributes make them useful and applicable in different way.

Like what you read? Give Samie Azad a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.