Sometimes called a symlink, alias or (in user interface terms) a shortcut.
A symbolic link is a file that points to another file. The file it’s pointing to might be a directory (because directories are really just a special kind of file).
If you double-click on a symbolic link’s icon, most user interfaces will treat that exactly as if you’d double-clicked on the thing it is linking too. This is why symbolic links (especially on your desktop) are so useful.
This is handy because it means you can effectively put files (or directories) in more than one place in the filesystem. They are not really there — but that’s because a file can only be in one place — but the symbolic link means that the file can be found as if it was.
When you are auto-completing on the command line, you can usually follow symbolic links. So this is a very useful way to make navigating the file system easier.
Make a symlink on Unix
Make a symbolic link using the
ln command with the
-s option for symbolic
link (as opposed to a hard1 link).
The link itself is just a file, so you need to give it a filename when you create it.
For example, if you have a file called
do_sums.py in a
directory, you can make a symbolic link called
that links to it with:
ln -s programs/do_sums.py link-to-sums
That creates the symbolic link called
link-to-sums in the current directory.
Deleting a symbolic link does not delete the file it is linking to. However, renaming, moving, or deleting a file that a symbolic link is pointing to breaks the link (and leaves it “dangling”).
1 Hard links are a little more powerful; normally that’s not what you want. Whereas a symbolic link is really just pointing to the other file, a hard link is more like a duplicate that the system knows is a clone, and when you delete a hard link, you're deleting all the clones too.