A symbolic link (or "symlink") is file system feature that can be used to create a link to a specific file or folder. It is similar to a Windows "shortcut" or Mac "alias," but is not an actual file. Instead, a symbolic link is a entry in a file system that points to a directory or file. The system recognizes the symbolic link as the actual directory or file, providing a alternate way to access it.
Symbolic links are supported by Mac, Windows, and Unix, but are most commonly found on Unix systems, since Unix is known for having a large (and often confusing) hierarchy of directories. The root folder alone has several different subdirectories, many of which do not have a clearly defined purpose. Examples include bin, dev, etc, lib, tmp, usr, and var. This can make it difficult to find certain files, especially if they are located several directories deep in the file system. Symbolic links help alleviate this problem by creating an easier way to access common files and folders.
To create a symlink in Unix, you can type a simple command at the command prompt using the syntax below. (The "-s" part of the command is important, since it tells the system to create a symbolic link.)
ln -s [target directory or file] /[shortcut]
For example, you can create a symlink "/apachelogs" that points to "/usr/local/apache/logs" using the following command:
ln -s /usr/local/apache/logs /apachelogs
After entering the command above, you would be able to access the Apache logs directory by simply opening "/apachelogs." While symlinks are recognized by most programs, it may be necessary to enable a program or process to follow symbolic links. For example, in order for an Apache web server to recognize symbolic links, the line "Options +FollowSymLinks" must be added to the httpd.conf file.
Updated: October 22, 2013