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
Links
- 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
readlinkcan be used to view the file behind a softlink- broken soft links are highlighted in red in the output of
ls -l