A symbolic link (symlink or soft link) is a file that contains a path reference to another file or directory. The kernel follows the path transparently, so applications see the symlink as if it were the original file. Symlinks are used everywhere in Ubuntu — to make versioned binaries accessible as generic names, to create alternative paths to configuration files, and to enable flexible service configurations.

Symbolic link:
/usr/bin/python → /usr/bin/python3.12
         |                |
       symlink          actual file (inode on disk)

The symlink is just a tiny file containing the string "/usr/bin/python3.12"
When you run "python", the kernel reads the symlink, finds python3.12, and runs it.

ls -la /usr/bin/python:
lrwxrwxrwx 1 root root 9 Mar 12 10:00 /usr/bin/python -> python3.12
^                                                       ↑
l = symlink type                          Target of the link
# Create a symlink: ln -s target linkname
# target = where the link points TO
# linkname = the new link being created

# Link to a file
ln -s /etc/nginx/sites-available/mysite /etc/nginx/sites-enabled/mysite

# Link to a directory
ln -s /data/app-current /opt/app

# Create a link in a specific location with a different name
ln -s /opt/python3.12/bin/python3 /usr/local/bin/python

# Overwrite an existing symlink (-f flag)
ln -sf /opt/python3.13/bin/python3 /usr/local/bin/python

# Create with absolute path (recommended — relative paths break when moved)
ln -s /absolute/path/to/target /absolute/path/to/link

💡 TIP: Always use absolute paths when creating symlinks, not relative paths. A relative symlink works only when the link is in the same directory — if you move the link, it breaks. Absolute paths remain valid regardless of where the link file itself lives.

# View the symlink target
ls -la /usr/bin/python
readlink /usr/bin/python           # Show target (one level)
readlink -f /usr/bin/python        # Follow all links to final target

# Check if a file is a symlink
[ -L /usr/bin/python ] && echo "is a symlink"
file /usr/bin/python

# Verify where a symlink ultimately points
readlink -f /etc/nginx/sites-enabled/mysite

# Delete a symlink (unlink = delete the link, not the target)
rm /etc/nginx/sites-enabled/mysite
unlink /etc/nginx/sites-enabled/mysite    # Alternative

# Find all symlinks in a directory
find /etc/nginx/sites-enabled -type l
find /usr/bin -type l | head -10

Common real-world uses

# 1. Nginx site enabling (sites-available → sites-enabled pattern)
sudo ln -s /etc/nginx/sites-available/mysite /etc/nginx/sites-enabled/mysite
sudo nginx -t && sudo systemctl reload nginx

# 2. Managing multiple Python versions
sudo ln -sf /usr/bin/python3.12 /usr/local/bin/python3
sudo ln -sf /usr/local/bin/python3 /usr/local/bin/python

# 3. Application version switching (blue-green deployments)
# current → specific version directory
sudo ln -sfn /opt/app-v2.1.0 /opt/app/current
# Update to new version instantly:
sudo ln -sfn /opt/app-v2.2.0 /opt/app/current
# Rollback is immediate:
sudo ln -sfn /opt/app-v2.1.0 /opt/app/current

# 4. Consolidating configuration in home directory
ln -s /data/config/vim/vimrc ~/.vimrc     # Link to central config
ln -s /data/config/bash/bashrc ~/.bashrc

A broken symlink points to a target that no longer exists. Broken symlinks show up in listings, cause errors when applications try to use them, and can be hard to spot.

# Find all broken symlinks in a directory
find /etc/nginx/sites-enabled -xtype l
find /usr/bin -xtype l

# Find broken symlinks in the entire system
sudo find / -xtype l 2>/dev/null | head -20

# What does a broken symlink look like?
ls -la /etc/nginx/sites-enabled/

ls output showing a broken symlink (in red if terminal colors enabled)

lrwxrwxrwx 1 root root 40 Jun 01 12:00 mysite -> /etc/nginx/sites-available/mysite
lrwxrwxrwx 1 root root 44 Jun 01 11:00 oldsite -> /etc/nginx/sites-available/oldsite  ← broken (target deleted)
# Remove broken symlinks automatically
find /etc/nginx/sites-enabled -xtype l -delete

# Or investigate before deleting
find /etc -xtype l -exec ls -la {} \;

Conclusion

Symlinks are a fundamental Linux tool. The key rules: use absolute paths (not relative), use ln -sf to update an existing symlink safely, use rm or unlink to delete a symlink without affecting the target, and use find -xtype l to discover broken symlinks. The Nginx sites-available/sites-enabled pattern is the canonical example of symlinks enabling clean, reversible configuration management.

FAQ

Is Working with Symbolic Links important for Ubuntu administrators?+

Yes. It supports practical Ubuntu administration because it connects directly to server reliability, security, troubleshooting, or daily operations.

Should I practice this on a live server?+

Use a lab VM first. After you understand the command output and rollback path, apply the workflow carefully on real systems.

What should I do after reading this article?+

Run the practice commands, write down what each one shows, and continue to the next article in the Ubuntu roadmap.

Need help with Ubuntu administration?

Work directly with Muhammad Irfan Aslam for Ubuntu Server, Linux, cloud, Docker, DevOps, CI/CD, or infrastructure troubleshooting support.

Hire Me for Support