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

Issam Sebri
2 min readFeb 3, 2020

When we try to figure out the difference between the hard link and the symbolic link we need to take a look behind the scene and decode some UNIX filesystem architecture.

Unix filesystem does not contain files and directories, instead it contains a pointer to the index node “Inode”,a data structure, which in turn contain a “Metadata” (Size, Blocks, Permissions…) and the file itself, it’s a kind of identity card of the files.

The symbolic link (or symlink), or like i prefer to call it a Soft link, is a file that refers to another one, and what i need to mention here is that the soft link and the target are not sharing the same Inode, it’s kind of a shortcut (mostly knowing on Windows system). the symbolic link has no direct access to the spot of data in your hard driver, however he has the execution name of file in your system which had the right access.

In the previous list of files we see each file the target and link_to_target has his own inode.

Unlike the soft link, the hard link is an image of the linked target that shares the same inode, every additional hard link is like giving another name to the same file.

The different hard links points to the same spot of data in the hard drive. And every modification of this data appear in the all links, but every delete of the data target have no side effect until we kill all the file’s head.

The hard link and the target share the same inode

Let us underline at the end of this article the importance of the role played by the hard link and the symbolic link in the construction of the UNIX file system.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Issam Sebri
Issam Sebri

No responses yet

Write a response