A link is an alternate name for a file. Linux has two flavors, and they behave very differently.
Every file on a filesystem is stored at an inode, a numeric ID. The "name" of a file is a directory entry that points at that inode. A hard link is just another directory entry pointing at the same inode.
echo hi > original.txt # a file to link to
ln original.txt copy.txt # creates a hard link
ls -li # -i shows the inode number
Both original.txt and copy.txt show the same inode. They're
two names for one file. Delete one, the file is still there under
the other name. Edit one, both "see" the change because there's
only one file underneath.
Limitations:
Hard links are useful for deduplication and backup tools. In daily DevOps work, you'll rarely create one on purpose.
A symlink is a small file that contains a path pointing at another file or folder. Following a symlink is like following a shortcut.
ln -s /var/www/releases/v2 /var/www/current
Now /var/www/current is a symlink pointing at
/var/www/releases/v2. Reading /var/www/current/index.html
transparently reads /var/www/releases/v2/index.html.
ls -l /var/www/current
A symlink shows an l as the first character and an arrow to
its target:
lrwxrwxrwx 1 root root 23 Jul 14 10:30 current -> /var/www/releases/v2
Regular files show -, directories show d, and hard links look
exactly like regular files (because they ARE regular files, just
under a different name).