Difference Between Hard link and Soft link in Linux
Hard link can be crated on same filesystem. It has same inode (inode is one of the data structure in Linux kernel which keeps information about file). Here is the command to create hard link, ln file1 file2
Hard link has some limitation like, hard link can not be created on directories and with other filesystem.
Soft link can be created across the file system, it will be having different inode value than original file and that's the reason if some deletes original file, the link file will be on hung state. To create soft link use command, ln -s origfile linkfile
To identify which one is a hard link and which one is softlink, one can run this command i.s. ls -i and compare the inode value.
Happy Learning :)
Subscribe to my newsletter
Read articles from PK Jha directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by