Linux Administration Medium technical 0 views 1 min read

What is the difference between a hard link and a symbolic link?

Peer-reviewed by HireXTech Technical Panel Updated for 2025/2026 hiring Editorial standards
Practise this track
Interviewer Expectations for this Question
01
Core Competency

Assesses fundamental understanding of Linux Administration conventions, runtime behavior, and memory/performance considerations.

02
Evaluation Criteria

Hiring managers look for precision, avoidance of ambiguous jargon, and ability to explain trade-offs under real production conditions.

Comprehensive Model Answer Verified Solution

Both point to files, but at different levels.

  • Hard link: another directory entry for the same inode. The file data is shared, and the link count increases. Deleting one name does not remove the data until all links are gone. Hard links cannot cross filesystems and usually cannot point to directories.
  • Symbolic (soft) link: a separate file containing the path to the target. It can cross filesystems, point to directories, and become dangling if the target is removed. Permissions on the link itself are ignored; the target's permissions apply.
ln file.txt hard.txt      # hard link
ln -s /var/www site       # symbolic link
ls -li                    # shows inode and link count
readlink site

Use hard links for deduplication and backups within a filesystem, such as rsync --link-dest, and symlinks for flexible references such as versioned releases and config pointers.

Candidate Response Strategy & Interview Tips

  1. Start with a concise one-sentence summary: Deliver a direct, confident answer first before expanding into nuances.
  2. Demonstrate real-world trade-offs: Discuss where this approach excels and when you would avoid it in production systems.
  3. Discuss complexity & edge cases: Proactively explain time/space complexity or boundary conditions (null values, scale limits).
  4. Prepare for interviewer follow-ups: Technical hiring panels frequently probe deeper into concurrency, backward compatibility, or alternative libraries.
Related Topics & Skills
Spotted an error or have an alternative solution?