What is Soft link and Hard link in Linux ?.

What is Soft link and Hard link in Linux ?.

what is soft link and hard link in linux


Managing link between files. We are created two links
    • Hard Links
    • Soft Links
  • Hard Links : Hard Links is a new directory entry with a reference to an existing file on the file system. Each hard linked file is assigned the same Inode value as the original and file size is also same. Hard links more flexible and remain linked even if the original or linked files are moved throughout the file system, although hard links are unable to cross different file systems. If the original file is removed, the link will still work as it accesses the data the original was having access to.
    • ls -l : shows the hard link count.
    • ln :  This command creates new hard links to existing files.
  • Soft Link : A soft link is not a regular file. A soft link is similar to the file shortcut feature which is used in Windows Operating systems. Each soft linked file contains a separate Inode value that points to the original file. As similar to hard links, any changes to the data in either file is reflected in the other. If the original file is removed, the link will not work as it doesn’t access the original file’s data.
    • ln -s : This command creates new soft link, which is also called  a “symbolic link”
mukesh.thakur87: