A link is a pointer to a file. Interix supports both hard and symbolic links. You use the ln(1) command to create links.
By default, ln creates a hard link to an existing file. A hard link is a pointer to a file and is indistinguishable from the original directory entry. The link appears as an additional file name for the original file. If a link is made in the same directory, the file names used in the link must be different. If a link is made in a different directory, the same file name can be used. Any changes to a file are effective independent from the name used to reference the file. Additionally, hard links can not refer to a directory; nor can they span file systems.
A symbolic link, also known as a soft link, is an indirect pointer to a file. The directory entry for a symbolic link contains a pointer to the name of the original file. Symbolic links can point to directories and span file systems.
The syntax for creating a hard link is as follows:
ln existing-file new-linkFor example, the following command creates a hard link called budget in the courtney directory to the same data used by the existing file /carl/budget:
ln /carl/budget /courtney/budgetYou can create a symbolic link with ln and the -s option. The following example creates a symbolic link from /tmp/report to /carl/report. The /tmp/report file is pointing to the file /carl/report and not directly to the data:
ln -s /carl/report /tmp/reportIn Interix, a symbolic link is a special system file that contains an eight-byte header plus the path and file name of the target file in two-byte Unicode characters. The POSIX specification requires the lstat(2) function (and consequently any utilities that call that function) to report the size of the symbolic link as the length of the path and file name of the target file. Consequently, Interix utilities (such as ls(1)) and Win32 utilities (such as dir) will not report the same size for the symbolic link file.