|
|
1.1 root 1: .\" Copyright (c) 1980, 1990 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted provided
5: .\" that: (1) source distributions retain this entire copyright notice and
6: .\" comment, and (2) distributions including binaries display the following
7: .\" acknowledgement: ``This product includes software developed by the
8: .\" University of California, Berkeley and its contributors'' in the
9: .\" documentation or other materials provided with the distribution and in
10: .\" all advertising materials mentioning features or use of this software.
11: .\" Neither the name of the University nor the names of its contributors may
12: .\" be used to endorse or promote products derived from this software without
13: .\" specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)ln.1 6.5 (Berkeley) 7/24/90
19: .\"
20: .Dd July 24, 1990
21: .Dt LN 1
22: .Os BSD 4
23: .Sh NAME
24: .Nm ln
25: .Nd make links
26: .Sh SYNOPSIS
27: .Nm ln
28: .Op Fl s
29: .Ar source_file
30: .Op target_file
31: .Nm ln
32: .Op Fl s
33: .Ar source_file ...
34: .Op target_dir
35: .Sh DESCRIPTION
36: The
37: .Nm ln
38: utility creates a new
39: directory entry (linked file)
40: which inherits the same modes as the orginal
41: file.
42: It is useful for maintaining multiple copies of a file in
43: many places at once - without the `copies'; instead,
44: a link `points' to the original copy.
45: There are two types of links; hard links and symbolic links.
46: How a link `points' to a file is one of the differences
47: between a hard or symbolic link.
48: .Pp
49: Option available:
50: .Tw Ds
51: .Tp Fl s
52: Create a symbolic link.
53: .Tp
54: .Pp
55: By default
56: .Nm ln
57: makes
58: .Em hard
59: links.
60: A hard link to a file is indistinguishable from the
61: original directory entry; any changes to a
62: file are effective independent of the name used
63: to reference the file. Hard links may not refer to directories
64: (unless the proper incantations are supplied) and may not span
65: file systems.
66: .Pp
67: A symbolic link contains the name of the file to
68: which it is linked. The referenced file is used when an
69: .Xr open 2
70: operation is performed on the link.
71: A
72: .Xr stat 2
73: on a symbolic link will return the linked-to file; an
74: .Xr lstat 2
75: must be done to obtain information about the link.
76: The
77: .Xr readlink 2
78: call may be used to read the contents of a symbolic link.
79: Symbolic links may span file systems and may refer to directories.
80: .Pp
81: Given one or two arguments,
82: .Nm ln
83: creates a link to an existing file
84: .Ar source_file .
85: If
86: .Ar target_file
87: is given, the link has that name;
88: .Ar target_file
89: may also be a directory in which to place the link;
90: otherwise it is placed in the current directory.
91: If only the directory is specified, the link will be made
92: to the last component of
93: .Ar source_file .
94: .Pp
95: Given more than two arguments,
96: .Nm ln
97: makes links in
98: .Ar target_dir
99: to all the named source files.
100: The links made will have the same name as the files being linked to.
101: .Sh SEE ALSO
102: .Xr rm 1 ,
103: .Xr cp 1 ,
104: .Xr mv 1 ,
105: .Xr link 2 ,
106: .Xr readlink 2 ,
107: .Xr stat 2 ,
108: .Xr symlink 2
109: .Sh HISTORY
110: A
111: .Nm ln
112: command appeared in Version 6 AT&T Unix.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.