In this video I would like to tell you about hard and symbolic links.
It's all about file names and making them more accessible.
File names are stored in an internal structure that is known as the directory table.
And a link is a pointer in the directory that refers to another file or directory.
And there's two types of them.
Hard links are pointing to the same inode on the same file system.
Now what is an inode? The inode is the unique administration that exists
for all files and in which the properties of your files are stored.
Symbolic links are shortcuts and they add additional flexibility.
Now symbolic links can exist on a directory, which is not the case for hard links.
You can also create cross device symbolic links to point to files that exist on another device.
In general, links can be useful to ensure that specific information is available at different locations.
Before I show you how to work with them, let me make a drawing that is making it clear how exactly these links are organized.
Let me explain hard links and symbolic links. In order to understand we need to know a little bit more about
the file Files is in the end all about blocks, blocks of data that is stored to your hard disk.
These blocks need to be made accessible and they need to be managed.
And in order to do so, the Linux file system provides the inode.
The inode is a complete administration of a file. Every file, no matter
which file system it is, has an inode and one inode only.
Now the funny thing about inodes is that in the inode you don't have the name of
the file. And for that reason you can have multiple names like name one and name two.
And these names are independent of one another. So it doesn't matter which one you make first, doesn't matter which
one you remove first. There is no dependency between these names. They are just a pointer to the inode.
Now these names is what we call hard links.
There's also a symbolic link.
And the difference is that the symbolic link is a name that is pointing to a.
So we have symbolic link one and we have symbolic link two. They offer a little bit more flexibility as I will explain in a bit.
But there's also one problem. If something happens to name one, then your symbolic links become invalid. So
there's a dependency relation there. Symbolic links go to a name and they don't go to an inode.