added depend label
[unix-history] / usr / src / bin / ln / ln.1
CommitLineData
8b99182b
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
7529dd22 5.\" @(#)ln.1 6.3 (Berkeley) %G%
8b99182b 6.\"
7a0db1cc 7.TH LN 1 ""
8b99182b
KM
8.UC 4
9.SH NAME
10ln \- make links
11.SH SYNOPSIS
12.B ln
da202ae8
KM
13[
14.B \-s
15]
9f0d4865 16sourcename [ targetname ]
8b99182b
KM
17.br
18.B ln
9f0d4865
KM
19[
20.B \-s
21]
22sourcename1 sourcename2 [ sourcename3 ... ] targetdirectory
8b99182b
KM
23.SH DESCRIPTION
24A link is a directory entry referring
25to a file; the same file (together with
26its size, all its protection
27information, etc.)
28may have several links to it.
da202ae8
KM
29There are two kinds of links: hard links and symbolic links.
30.PP
31By default
32.I ln
33makes hard links.
34A hard link to a file is indistinguishable from the
35original directory entry; any changes to a
36file are effective independent of the name used
7529dd22
KB
37to reference the file. Hard links may not refer to directories
38(unless the proper incantations are supplied) and may not span
39file systems.
da202ae8
KM
40.PP
41The
42.B \-s
43option causes
44.I ln
45to create symbolic links.
46A symbolic link contains the name of the file to
47which it is linked. The referenced file is used when an
48.IR open (2)
49operation is performed on the link.
50A
51.IR stat (2)
52on a symbolic link will return the linked-to file; an
53.IR lstat (2)
54must be done to obtain information about the link.
55The
56.IR readlink (2)
57call may be used to read the contents of a symbolic link.
58Symbolic links may span file systems and may refer to directories.
8b99182b
KM
59.PP
60Given one or two arguments,
61.I ln
62creates a link to an existing file
9f0d4865 63.IR sourcename .
8b99182b 64If
9f0d4865 65.I targetname
8b99182b 66is given, the link has that name;
9f0d4865 67.I targetname
8b99182b
KM
68may also be a directory in which to place the link;
69otherwise it is placed in the current directory.
da202ae8
KM
70If only the directory is specified, the link will be made
71to the last component of
9f0d4865 72.IR sourcename .
8b99182b
KM
73.PP
74Given more than two arguments,
75.I ln
9f0d4865
KM
76makes links in
77.I targetdirectory
78to all the named source files.
8b99182b 79The links made will have the same name as the files being linked to.
8b99182b 80.SH "SEE ALSO"
da202ae8 81rm(1), cp(1), mv(1), link(2), readlink(2), stat(2), symlink(2)