Hard Links And Symbolic Links
What are they?
Symbolic links and hard links all begin with whats called an inode. An inode is basically a system that stores the physical cordinates for a file on your drive. When you create a file and give it a name it is essentialy a Hard Link in itself since you are creating a Filename to a new inode. When a Hard Link is created it makes a text that points to the same inode as the orginal file. When a Symbolic Link is created it makes a text that points to the filename of the designated file.
Hard Links:
To create a Hard Link you are gonna wanna use the ln command → ln [filename] [hard_name]
Here are some examples of using the command:
Symbolic Links:
To create a link you are gonna wanna use the ln command with the -s option like this → ln -s [filename] [Symbo_link_name]
Here are some examples of using the command:
What will happen if I delete the file?
If you delete the file that the symbolic link points to the link will no longer function since it points to nothing. If you delete the file that a Hard link is pointing to it will still point to the inode of the orginal file in return using the same amount of disk space. This is what seperates Hard Links and Soft Links. Since a soft link only points to the filename when the file is deleted to link cant point anywhere. However a Hard Link can still point to the original file.