ln(C) 19 June 1992 ln(C) Name ln - make a link to a file Syntax ln [ -s ] [ -f ] sourcename targetname ln [ -s ] [ -f ] sourcename1 sourcename2 [ sourcename3 ... ] targetdirectory Description A link is a directory entry referring to a file; a single file (together with its size, all its protection information, etc.) may have several links to it. There are two kinds of link: hard links and symbolic links. By default ln makes hard links. A hard link to a file is indistinguish- able from the original directory entry; any changes to a file are effec- tive 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 con- tains the name of the file to which it is linked; this file does not need to exist prior to the symbolic link. The referenced file is used when an open(S) operation is performed on the link. A stat(S) on a symbolic link will return the linked-to file; a stat(S) must be performed to obtain in- formation about the link. The readlink(S) call may be used to read the contents of a symbolic link. Symbolic links may span file systems and may refer to directories. Given two arguments, ln creates a link to a file sourcename. If target- name is a file, the link has that name; targetname may also be a direc- tory 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 sourcename. Given more than two arguments, ln makes links in targetdirectory to all the named source files. The links made will have the same names as the files being linked to. If ln determines that the mode of target forbids writing, it will print the mode (see chmod(C)), ask for a response, and read the standard input for one line. If the line begins with y, the ln occurs, if permissible; if not, the command exits. When the -f option is used or if the standard input is not a terminal, no questions are asked and the ln is performed. See also cp(C), mv(C), rm(C) Standards conformance ln is conformant with: AT&T SVID Issue 2; and X/Open Portability Guide, Issue 3, 1989.