Soft Links (i.e.Symlinks or Symbolic Links) and Hard Links in Linux File Systems

199

Most of us know that, every single component of Linux file systems is associated with an Inode. Every single element in the Linux file systems is uniquely identified by an Inode number. In one of my previous articles, Understanding Inodes in Linux/Unix File Systems, I have explained ‘What Inodes are’, ‘How they can be accessed’ and ‘How they are used’.

This article can be considered as a continuum of the above mentioned article and this article will elaborate on Links in Linux file systems, which are Soft Links (also known as Symlinks or Symbolic Links) and Hard Links.

Here we go!

What are Links..?

Links in Linux/Unix can are very much similar to Pointers in programming languages. The basic difference is that, Pointers in programming languages are used to point to the other variables, likewise Link is a pointer to a file or a directory. Creating a links is very much similar to creating a shortcut to a file in order to access it.

There are two kinds of these links based on their properties, which are:
1. Soft Links or Symbolic Links or Symlinks
2. Hard Links

Let’s see what exactly they are.

Soft Links:
If you have been using Windows operating systems, understanding Soft Links would be an easier task for you. You can just compare Soft Links in Linux with the ‘shortcuts’ in Windows, they do not possess any information in them, but they point to the location of a file or a directory in the file system. Eventually, when original file is lost, Soft Links lose their importance.

Hard Links:
Again, when compared to Windows operating systems, Hard Links in Linux are very much similar to ‘Copy’ of a file in Windows. A bit of difference is that, whenever any changes are made to original file, those changes are reflected in the Hard Links, unlike in Windows. But, when the original file is lost, the contents in the Hard Links are still preserved. How? Lets see in the upcoming section.

 

Read more at YourOwnLinux