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