LN(1) COMMAND REFERENCE LN(1) NAME ln - make links SYNOPSIS ln [ -s ] [ -f ] name1 [ name2 ] ln [ -s ] [ -f ] name ... directory DESCRIPTION A link is a directory entry referring to a file; the same file (together with its size, all its protection information, etc.) may have several links to it. There are two kinds of links: hard links and symbolic links. By default ln makes hard links. A hard link to a file is indistinguishable from the original directory entry; any changes to a file are effective independent of the name used to reference the file. Hard links may not span file systems and may not refer to directories. The -s option causes ln to create symbolic links. A symbolic link contains the name of the file to which it is linked. The referenced file is used when an open(2) or creat(3c) operation is performed on the link. A stat(2) on a symbolic link returns the linked-to file; an lstat(2) must be done to obtain information about the link. The readlink(2) call may be used to read the contents of a symbolic link. Symbolic links may span file systems and may refer to directories. The -f option causes ln to attempt to make hard links to directories; this can only be done by the superuser and can cause problems (see CAVEATS). Given one or two arguments, ln creates a link to an existing file name1. If name2 is given, the link has that name; name2 may also be a directory in which to place the link; otherwise it is placed in the current directory. If only the directory is specified, the link will be made to the last component of name1. Given more than two arguments, ln makes links to all the named files in the named directory. The links made will have the same name as the files being linked to. OPTIONS -f ln attempts to make hard links to directories; this can only be done by the superuser and can cause problems (see CAVEATS). -s ln creates a symbolic link. Printed 4/6/89 1
LN(1) COMMAND REFERENCE LN(1) EXAMPLES The following example causes a hard link called c to be made to the file /bin/cat: ln /bin/cat c This example causes a symbolic link called temp to be made to the directory /tmp: ln -s /tmp temp RETURN VALUE [NO_ERRS] Command completed without error. [USAGE] Incorrect command line syntax. Execution terminated. [NP_WARN] An error warranting a warning message occurred. Execution continues. [P_WARN] A system error occurred. Execution continues. See intro(2) for more information on system errors. CAVEATS The force option (-f) should only be used when absolutely neccessary. If a hard link is made to a directory and both the directory and link are removed, the system may crash. SEE ALSO rm(1), cp(1), mv(1), link(2), readlink(2), stat(2), open(2), lstat(2), symlink(2), and creat(3c). Printed 4/6/89 2
%%index%% na:192,67; sy:259,289; de:548,2183; op:2731,415; ex:3410,356; rv:3766,552; ca:4318,290; se:4608,315; %%index%%000000000134