Hard link and Symbolic link

What is Inode?
In Linux each file or folder is assigned a unique integer number called inode.

In Linux each file or folder is assigned a unique integer number called inode which stores the following information.
- The file or folder permissions.
- The owner of the file and folder.
- The position / location of the file or folder within our hard drive.
- The creation date of the file or directory.

What is hard link?
A hard link is a file which points to a file which is stored on disk. Therefore, the two files have the same inode and point to the same file saved on disk.
But this can only happen if the two files are in the same partitions of the disk.
1-touch [option] [file] →Create files.
2-ls [option][file] →List content of current directory.
3-ln: It is the command in charge of making links between links or folders.
How to create a hard link
1. Create file hardfile.txt
touch hardfile.txt
2. Then we consult the inode
ls -li hardfile.txt
- result
1341693 -rw-r--r-- 1 joan joan 0 nov 17 22:50 hardfile.txt
1341693 →Inode of file
1 →file/input in the system
3.Create hard link to created file
ln hardfile.txt enlacehardfile
4. Finally review step 2
ls -li hardfile.txt
Result
1341693 -rw-r--r-- 2 joan joan 0 nov 17 22:50 hardfile.txt

What is symboly link?
Symbolic links are similar to windows.
For these links they point to the name of a file and then this file points to another file which is stored on the hard disk
How to create a symbolic link
1. Create file hardfile.txt
touch hardfile.txt
2. Then we consult the inode
ls -li hardfile.txt
- result
1341693 -rw-r--r-- 1 sebas sebas 0 nov 17 22:50 hardfile.txt
1341693 →Inode of file
1 →file/input in the system
3. Create symbolic link
ln -s /home/sebas/hardfile.txt /home/sebas/Desktop/enlacehardfile
ln: It is the command in charge of making links between links or folders.
- s: It is the part of the command that indicates that the type of link we want to create is a symbolic link.
4. Finally review step 2
ls -li hardfile.txt
Result
1341693 -rw-r--r-- 1 sebas sebas 0 nov 17 22:50 hardfile.txt
Differences between hard links and symbolic links
- Symbolic links can do both connal and manual, while hard links can only be internal.
- Hard links share the inode number, symbolic ones do not.
- Hard links are exact copies of the file while symbolic links are mere pointers or “shortcuts”.