LINUX / A CONCEPT NOTE
Symlinks & Hard Links
two names for one file
Overview · mechanism
pitfall · examples
01 / THE SHORT VERSION
The idea in a few sentences.
A symlink is a pointer file referencing another file path (like a shortcut). A hard link is a duplicate directory entry pointing directly to the file's raw disk sectors (inode).
02 / FOLLOW THE MECHANISM
How symlinks vs hard links behave
Symlink read
OS opens symlink, reads the path target string, and redirects to target file.
Hard link read
OS maps hard link directory entry directly to the file's raw disk partition inode.
Target deleted
if target is deleted, symlink breaks immediately, but hard link still opens the data.
Link limits
hard links cannot span different filesystems or reference directories.
04 / COMMAND NOTES
Read the command, then the result.
Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.
create a symbolic link
ln -s target.txt shortcut.txtcreate a hard link
ln target.txt hardlink.txt05 / CHECK YOURSELF
Could you explain Symlinks & Hard Links to a teammate?
Try it out loud in two sentences: what it is, and the one detail that changes the picture. If you stall, the gap is the part to reread.
Up next in Linux & systemsExit Codeshow scripts know something failed