Ln is a Unix command to create file associations (links) to files. The program is used in order to create hard and symbolic links. To delete commands unlink and rm are used analogously.
The libc functions link () and unlink ( ) are used for the same command line utility.
A ln Utility was already present in the first versions of AT & T UNIX.
Use with a parameter
Ln must always be called with at least one argument. The first argument always represents the source file is, ie the name of the existing file. If no second argument is given, then an eponymous link will be created on the file in the current working directory. A call such as
Ln / path / to / source file therefore creates a link named source file in the current working directory. A call like ln source file inevitably leads to an error because this would create a link to the same file that already exists in the current directory, two files but may not carry the same name in a folder.
Use with multiple parameters
When used with exactly two arguments represents the first source file, whereas the second argument specifies the name of the destination file to be created. The syntax is therefore:
In source file [target file] A use with more than two arguments is interpreted in such a way that initially multiple source data is specified to be linked to, and as the last argument is a directory in which the link symbols to be generated to these sources. A call such as
Ln file1 file2 file3 target-directory / thus created in the target directory with three hard links named file1, file2 file3 and.
When used with at least two parameters should be noted that the order and meaning of parameters as analogous to the equally common Unix commands cp and mv, used to copy or move files or folders works.
Generation of symbolic links
Like almost every Unix command also takes an additional parameter in the form ln ln parameters ... to. One of the most important and commonly used parameter is -s, which can be, instead of hard links, create symbolic links. Due to the limitations of hard links that point to directories, not even able to overcome partition boundaries are symbolic links in modern Unix derivatives, often used as Linux.