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