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