Links in a file system are additional directory entries or pointers to a file (i.e., those beyond the minimum required to establish the file's existence in the file system). Usually when the file is created, an entry is made in a directory. If the file system is flat, then the directory in this case is some list of all files. If another entry for the same physical file is created in the same or different directory, this additional entry is called a link. Consequently, the file is known by more than one name and may be accessed by more than one path through the directory tree. There are two types of links, hard links and symbolic links.
Usually, hard links are simply just multiple directory entries which point to the same physical file. The physical file usually consists of a file header and the data itself. The file header contains information about the file, such as, file access permissions and pointers to where the data is located. With hard links, it may not be possible to distinguish the directory entry created when the file was created from any other directory entry for the physical file. All directory entries pointing to the same physical file are equal.
On the other hand, a symbolic link is only a virtual link to a file. The physical file has a directory entry and may have hard links to it as well. A symbolic link to a file usually has a directory entry and a file header of its own. However, the file header for a symbolic link contains the name of a file to which the name of the symbolic link actually refers. Thus, given the name of a file which is a symbolic link, the system accesses the file pointed to by the symbolic link by obtaining the symbolic link name from the file header of the symbolic link. The symbolic link name is used to access the physical file. Symbolic links were developed in order to permit links to be made across different mounted file systems where the use of a hard link may not be feasible.
Some file systems support neither hard links nor symbolic links. Other file systems support links but the number of links to an individual file may be limited. In a network environment where several different file systems are mounted, an application may need to determine whether a hard or symbolic link can be made to a particular file, and how many links can point to a file.