Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

🏠 Back to Blog

Hard and Soft Links

Use ln to manage soft and hard links

Inodes

  • An inode is a reference to a file on the disk
  • The stat command can be used to view inodes
  • When there are 0 links to an inode, the data itself is erased from the disk
  • Hard links point to the same inode
  • You can only hardlink to files, not directories
  • You cannot hardlink to files on a mount, only files on the same filesystem
  • Soft links create a shortcut directly to the file, rather than a link to the inode
  • readlink can be used to view the file behind a softlink
  • broken soft links are highlighted in red in the output of ls -l