Jo Pinta
2 min readFeb 3, 2021

--

Inode : location of file on disk

There are two type of links:

Hard links and Symbolic Links

If you want to have a closer look on what are the differences between each other let start recalling the File Structure.

Each of the files in Linux is represented by what it’s called an Inode, which is the lowest element in the Operating System. It identifies a file for itself and the own metadata that it has, for example where is stored, what’s the size and how many blocks of memory is using .

There are two different ways to reference things.

When creating a file, the name given to it is where the Symbolic Link points, not to the Inode comparing to how Hard Links act (that is, pointing to the same memory space on disc)

Symbolic links point to a simbol, that’s why it is symbolic… just a name. In case you delete the file, the Symbolic Link will float around, with nothing to do, worthless.

Hard Link is different because is pointing to same disc’s physical memory. Let’s say that an other file is pointing to the same Inode , if you delete the Symbolic Link, the Inode is still being pointed from that other file. So this block Inode will not break free for the system to use it over. With the Symbolic Link this rule does not apply because of what was explained above.

In order to create them you will need to write:

for Symbolic Links: ln -s [file_name] [link name]

for Hard Links: ln [file_name] [link name]

The long list (ls -l command) will display the Hard links. Usually it´s going to be only one, the file.

Thank you and keep coding!

--

--