aboutsummaryrefslogtreecommitdiff
path: root/ja_JP.eucJP/man/man1/ln.1
blob: 57a380b7c7a465100aa55f713d5cae65942a4c70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
.\" Copyright (c) 1980, 1990, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the Institute of Electrical and Electronics Engineers, Inc.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"	@(#)ln.1	8.2 (Berkeley) 12/30/93
.\"	%Id: ln.1,v 1.6 1998/05/15 06:19:02 charnier Exp %
.\" jpman %Id: ln.1,v 1.2 1997/04/15 00:24:41 mutoh Stab %
.\"
.Dd December 30, 1993
.Dt LN 1
.Os BSD 4
.Sh 名称
.Nm ln
.Nd リンクファイルの作成
.Sh 書式
.Nm ln
.Op Fl fs
.Ar source_file
.Op target_file
.Nm ln
.Op Fl fs
.Ar source_file ...
.Op target_dir
.Sh 解説
.Nm
は新しいディレクトリエントリ(リンクファイル)を作成するユーティリティです。
リンクファイルのモードはオリジナルファイルと同じになります。
リンクファイルは
.Dq ファイルの内容のコピー
ではなく、
.Dq ファイルを指し示すポインタ
であり、1 つのオリジナル
ファイルを多くのディレクトリで取り扱えるようにするのに有効です。
リンクファイルには、ハードリンクとシンボリックリンクの 2 つの形式があり
ます。違いは、リンクの方法です。
.Pp
オプションとしては以下のものがあります。
.Bl -tag -width flag
.It Fl f
リンクが成功するように、target_file を削除してから
source_file を target_file にリンクします。
.It Fl s
シンボリックリンクを作成します。
.El
.Pp
デフォルトでは、
.Nm
は
.Em ハードリンク
を作成します。
ファイルへのハードリンクはオリジナルのディレクトリエントリと区別できません。
ファイルの参照に使われる名前にかかわらず、
そのファイルへのいかなる修正も同じように有効です。
通常、ハードリンクはディレクトリを指すことはできませんし、
ファイルシステムを拡張することもできません。
.Pp
シンボリックリンクはリンク先ファイルの名前を保持します。
リンクに対して
.Xr open  2
操作を行うと、その参照先ファイルが用いられます。
シンボリックリンクに対して
.Xr stat  2
操作を行うと、参照先ファイルの情報を返します。
リンクそのものの情報を得るには
.Xr lstat  2
を用いなければなりません。
.Xr readlink  2
呼び出しによってシンボリックリンクの内容を読むこともできます。
シンボリックリンクによってファイルシステムを拡張したり、
ディレクトリを参照したりすることが可能です。
.Pp
1つあるいは 2つの引数が与えられた場合、
.Nm
は既存のファイル
.Ar source_file
に対するリンクを作成します。
.Ar target_file
が指定された場合、リンクの名前はそれと同一になります。
.Ar target_file
はリンクファイルを置くディレクトリであっても構いません。
それ以外の場合はリンクはカレントディレクトリに置かれます。
ディレクトリ名だけが指定された場合は、
.Ar source_file
のパス名の最後のファイル名が指定されたものとみなします。
.Pp
2つ以上の引数が与えられた場合、
.Nm
はディレクトリ
.Ar target_file
内に指定された全てのファイルのリンクを作成します。作られるリンクの
名前は、リンクされるファイルの名前と同じになります。
.Pp
.Sh 関連項目
.Xr link 2 ,
.Xr lstat 2 ,
.Xr readlink 2 ,
.Xr stat 2 ,
.Xr symlink 2 ,
.Xr symlink 7
.Sh 歴史
.Nm ln
コマンドは
.At v1
から登場しました。