Difference between hard link and soft link

Mohamed Foued Jenni
2 min readSep 15, 2020
Soft link vs hard link

Introduction :

This article is about “Hard link” & “Soft link” and the difference between them .

Soft Link:

A soft link also referred to as a symbolic link is a file that points to another file it is more like a shortcut to the real file .

You can create a soft link in Linux terminal by typing ln -s target link-name .

In the example below I’ve linked a file called “file” to a soft link called “link”

ln -s

Hard link

A hard link is a file that points to the same target inode (content) as the target file.

Here is an example of a hard link creation by using the ln command , the original file called “file” and the hard link called “link” so : ln file link .

Soft link vs Hard link

Deleting the hard link will result in deleting the content for both files (the link and the original file) .

Meanwhile deleting the soft link will result in just deleting the link itself .

That’s it for this article see you in the next one .

--

--