Problem Statement
What is the difference between a hard link and a symbolic link?
Explanation
Hard links create multiple directory entries pointing to the same inode (actual data on disk). All hard links are equal - deleting one doesn't affect others since they all reference the same data. Hard links cannot span filesystems or link to directories. Create with ln source target.
Symbolic links (symlinks) are special files containing a path to another file or directory. They're like shortcuts - if the original file is deleted, the symlink breaks becoming a dangling pointer. Symlinks can span filesystems and link to directories. Create with ln -s source target.
Use hard links when you need multiple references to the same data that persist even if one reference is deleted. Use symlinks for flexibility, creating shortcuts, or linking across filesystems. Most use cases prefer symlinks due to their flexibility, though hard links have performance advantages for large files since they don't add indirection.
