QA
Beginner LevelLinux Commands & SysAdmin

What is the difference between Symbolic Links (ln -s) and Hard Links (ln)?

❓ Interview Prompt: Compare Symbolic Links (symlinks: path pointers) vs Hard Links (inode pointers) and cross-filesystem limitations.

1. Symbolic Links (Symlinks - 'ln -s target link'):

•
A special file containing a text path reference pointing to another file.
•
Can point to directories and span across different filesystems.
•
If original target file is deleted, the symlink becomes 'broken'.

2. Hard Links ('ln target link'):

•
Creates an additional directory entry pointing directly to the same underlying disk inode.
•
Cannot span across different filesystems or point to directories.
•
File data remains on disk until ALL hard links are deleted!

Code Implementation Example

bash
# Create symbolic link (symlink)
ln -s /var/www/releases/v1.2.0 /var/www/current

# Create hard link
ln /data/original.txt /data/hardlink.txt

# Inspect inode numbers (same inode = hard links)
ls -li /data/
💡Creating symbolic links vs hard links and inspecting inodes.
🎯 Interview Key Takeaway

Use symbolic links (ln -s) for cross-filesystem shortcuts and directory links; use hard links to duplicate inode references.

#Symlinks#Hard Links#ln#Inodes#Beginner
Back to all Linux Commands & SysAdmin Questions→

More Linux Commands & SysAdmin Interview Questions

Beginner LevelLinux Commands & SysAdmin

How do Linux File Permissions (chmod, chown, chgrp) work in Octal and Symbolic notation?

Beginner LevelLinux Commands & SysAdmin

What is the Linux Filesystem Hierarchy Standard (/bin, /etc, /var, /usr, /opt, /tmp)?

Beginner LevelLinux Commands & SysAdmin

What are File Descriptors (0=stdin, 1=stdout, 2=stderr) and Redirection (>, >>, 2>&1)?