Abstract


  • It is like hyperlink on the webpage, that links up the components of File System

  • Pointing to Inode with data

  • Must be on the same File System


  • Space saving, we can have multiple references to a single set of data without duplicating the data

  • Like an additional name for an existing piece of data on disk. Deleting one hard link does not delete the data, as long as other links to that data remain

# Create a hard link to a file:
ln /path/to/file path/to/hardlink

  • When we create a Hard link on Soft (Symbolic) File System Link, we create a direct link to the existing piece of data on disk, so independent of the soft file system link

# To create a symlink:
ln -s <source-location> <symlink-location>
 
# To symlink, while overwriting existing destination files
ln -sf <source-location> <symlink-location>

Useful Commands


realpath

realpath path/to/file_or_directory