1.\" Copyright (c) 1980, 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)ln.1 6.6 (Berkeley) 03/14/91 7.\" 8.Vx 9.Vx 10.Dd 11.Dt LN 1 12.Os BSD 4 13.Sh NAME 14.Nm ln 15.Nd make links 16.Sh SYNOPSIS 17.Nm ln 18.Op Fl s 19.Ar source_file 20.Op target_file 21.Nm ln 22.Op Fl s 23.Ar source_file ... 24.Op target_dir 25.Sh DESCRIPTION 26The 27.Nm ln 28utility creates a new 29directory entry (linked file) 30which inherits the same modes as the orginal 31file. 32It is useful for maintaining multiple copies of a file in 33many places at once - without the `copies'; instead, 34a link `points' to the original copy. 35There are two types of links; hard links and symbolic links. 36How a link `points' to a file is one of the differences 37between a hard or symbolic link. 38.Pp 39Option available: 40.Tw Ds 41.Tp Fl s 42Create a symbolic link. 43.Tp 44.Pp 45By default 46.Nm ln 47makes 48.Em hard 49links. 50A hard link to a file is indistinguishable from the 51original directory entry; any changes to a 52file are effective independent of the name used 53to reference the file. Hard links may not refer to directories 54(unless the proper incantations are supplied) and may not span 55file systems. 56.Pp 57A symbolic link contains the name of the file to 58which it is linked. The referenced file is used when an 59.Xr open 2 60operation is performed on the link. 61A 62.Xr stat 2 63on a symbolic link will return the linked-to file; an 64.Xr lstat 2 65must be done to obtain information about the link. 66The 67.Xr readlink 2 68call may be used to read the contents of a symbolic link. 69Symbolic links may span file systems and may refer to directories. 70.Pp 71Given one or two arguments, 72.Nm ln 73creates a link to an existing file 74.Ar source_file . 75If 76.Ar target_file 77is given, the link has that name; 78.Ar target_file 79may also be a directory in which to place the link; 80otherwise it is placed in the current directory. 81If only the directory is specified, the link will be made 82to the last component of 83.Ar source_file . 84.Pp 85Given more than two arguments, 86.Nm ln 87makes links in 88.Ar target_dir 89to all the named source files. 90The links made will have the same name as the files being linked to. 91.Sh SEE ALSO 92.Xr rm 1 , 93.Xr cp 1 , 94.Xr mv 1 , 95.Xr link 2 , 96.Xr readlink 2 , 97.Xr stat 2 , 98.Xr symlink 2 99.Sh HISTORY 100A 101.Nm ln 102command appeared in Version 6 AT&T Unix. 103