Usage: ln [OPTION]... [-T] TARGET LINK_NAME (1st form)
or: ln [OPTION]... TARGET (2nd form)
or: ln [OPTION]... TARGET... DIRECTORY (3rd form)
or: ln [OPTION]... -t DIRECTORY TARGET... (4th form)
In the 1st form, create a link to TARGET with the name LINK_NAME.
In the 2nd form, create a link to TARGET in the current directory.
In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.
Create hard links by default, symbolic links with --symbolic.
When creating hard links, each TARGET must exist. Symbolic links
can hold arbitrary text; if later resolved, a relative link is
interpreted in relation to its parent directory.
長いオプションに必須の引数は短いオプションにも必須です.
--backup[=CONTROL] make a backup of each existing destination file
-b like --backup but does not accept an argument
-d, -F, --directory allow the superuser to attempt to hard link
directories (note: will probably fail due to
system restrictions, even for the superuser)
-f, --force remove existing destination files
-i, --interactive prompt whether to remove destinations
-L, --logical make hard links to symbolic link references
-n, --no-dereference treat destination that is a symlink to a
directory as if it were a normal file
-P, --physical make hard links directly to symbolic links
-s, --symbolic make symbolic links instead of hard links
-S, --suffix=SUFFIX override the usual backup suffix
-t, --target-directory=DIRECTORY specify the DIRECTORY in which to create
the links
-T, --no-target-directory treat LINK_NAME as a normal file
-v, --verbose print name of each linked file
--help この使い方を表示して終了
--version バージョン情報を表示して終了
バックアップ接尾辞は、--suffix や SIMPLE_BACKUP_SUFFIX が設定されないと `~' に
なります。バージョン管理方法は --backup オプションや VERSION_CONTROL 環境変数
を通じて選択できます。以下がその際の値です:
Using -s ignores -L and -P. Otherwise, the last option specified controls
behavior when the source is a symbolic link, defaulting to -P.
none, off バックアップを作らない (--backup をつけた時でも)
numbered, t 番号つきバックアップを作成する
existing, nil 番号つきバックアップがあれば番号つき、
そうでなければ、simple で
simple, never 常に簡易バックアップを作成
Report ln bugs to bug-coreutils@gnu.org
GNU coreutils home page:
Usage: ln [OPTION]... [-T] TARGET LINK_NAME (1st form)
or: ln [OPTION]... TARGET (2nd form)
or: ln [OPTION]... TARGET... DIRECTORY (3rd form)
or: ln [OPTION]... -t DIRECTORY TARGET... (4th form)
In the 1st form, create a link to TARGET with the name LINK_NAME.
In the 2nd form, create a link to TARGET in the current directory.
In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.
Create hard links by default, symbolic links with --symbolic.
When creating hard links, each TARGET must exist. Symbolic links
can hold arbitrary text; if later resolved, a relative link is
interpreted in relation to its parent directory.
Mandatory arguments to long options are mandatory for short options too.
--backup[=CONTROL] make a backup of each existing destination file
-b like --backup but does not accept an argument
-d, -F, --directory allow the superuser to attempt to hard link
directories (note: will probably fail due to
system restrictions, even for the superuser)
-f, --force remove existing destination files
-i, --interactive prompt whether to remove destinations
-L, --logical make hard links to symbolic link references
-n, --no-dereference treat destination that is a symlink to a
directory as if it were a normal file
-P, --physical make hard links directly to symbolic links
-s, --symbolic make symbolic links instead of hard links
-S, --suffix=SUFFIX override the usual backup suffix
-t, --target-directory=DIRECTORY specify the DIRECTORY in which to create
the links
-T, --no-target-directory treat LINK_NAME as a normal file
-v, --verbose print name of each linked file
--help display this help and exit
--version output version information and exit
The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
The version control method may be selected via the --backup option or through
the VERSION_CONTROL environment variable. Here are the values:
Using -s ignores -L and -P. Otherwise, the last option specified controls
behavior when the source is a symbolic link, defaulting to -P.
none, off never make backups (even if --backup is given)
numbered, t make numbered backups
existing, nil numbered if numbered backups exist, simple otherwise
simple, never always make simple backups
Report ln bugs to bug-coreutils@gnu.org
GNU coreutils home page:
LN(1) LN(1) 名前 ln - ファイルへのリンクを作成する 書式 ln [options] source [dest] ln [options] source... directory POSIX オプション: [-f] GNU オ プ ション (簡略形式): [-bdfinsvF] [-S backup-suffix] [-V {num- bered,existing,simple}] [--target-directory=dir] [--help] [--version] [--] 説明 ln コマンドはファイルへのリンクを作成する。特に指定がないとハードリンク を作成する; -s オプションを指定するとシンボリック (もしくはソフト) リン クを作成する。 Unix には通常ハードリンクとソフトリンクと呼ばれる、 2 つの「リンク」の 概念がある。ハードリンクは単にファイルの名前である。 (ファイルは複数 の 名 前を持つことができる。その最後の名前が削除された場合にのみディスク上 から実体が消去される。ファイルが持つ名前の数は ls(1) コマンドで知ること が できる。「もともと」の名前というものは無い: すべての名前は同じステー タスを持っている。通常、必須では無いが、ファイルの名前はすべてそのフ ァ イルシステム内にあり、それ自身のデータもそこに持っている。 ソ フトリンク (もしくはシンボリックリンク、または symlink) というのはま ったく違った種類のものである: 実体はパス名を含んだ小さくて特殊なファ イ ル である。従って、ソフトリンクは異なるファイルシステム上 (たぶん他のマ シンからマウントされた NFS) のファイルを指すことができる。また実際に は 存在しないファイルを指していても構わない。 (open(2) または stat(2) とい ったシステムコールにより) アクセスされた場合、シンボリックリンクへの 参 照 は、オペレーティングシステムのカーネルによりそのパス名で指示されるフ ァイルへの参照として置き換えられる。 (しかし 、 rm(1) コ マ ン ド や unlink(2) 関数ではリンク自身が削除され、リンクが指しているファイルは削 除されない。 lstat(2) や readlink(2) 関数といったシンボリックリンクや、 リ ンクが指しているファイル名のステータスを得る特殊なシステムコールがあ る。その他の色々なシステムコールでは、その操作の対象がシンボリックリ ン ク そのものなのか、それが指しているファイルなのかといったことについて、 オペレーティングシステム間で不明瞭さや違いがある。) · 1 つのファイルのみ与えられた場合、そのファイルをカレントディレクト リ にリンクする。つまり、(一番最後におかれた) ファイル名と同じ名前でファイ ルへのリンクをカレントディレクトリに作る。 (これは GNU での拡張機能であ る) · 最後の引き数がすでに存在するディレクトリであった場合、 ln コマンドは そのディレクトリ内に source ファイルで指示されたそれぞれに対するリン ク を作る。その名前は (一番最後におかれた) source ファイルの名前と同じ名前 を持つ。 (以下の --no-dereference オプションの説明を参照) · 引き数にファイルが2つ指定された場合、 source を指す dest という名前の リ ンクが作成される。最後の引き数がディレクトリでは無いのに、2 つ以上の ファイルが指定された場合はエラーとなる。 特に指定がないと、 ln コマンドは存在しているファイルや、シンボリック リ ン クの削除はできない。 (そのため、ロックの目的で使うことができる: dest が存在しない場合のみ正常終了する) -f オプションを指定することで強制的に 削除することができる。 今 ある実装では、ディレクトリへのハードリンクの作成ができる場合でも、ス ーパーユーザーにのみ許される操作としている。 link(2) システムコー ル や ln コマンドでのディレクトリへのハードリンクの作成を POSIX では禁止して いる。 (しかし異種のファイルシステムをまたがったハードリンクは禁止し て いない。) POSIX オプション -f 指定したリンクファイルがすでにあった場合は削除する。 GNU オプション -d, -F, --directory スーパーユーザーがディレクトリへのハードリンクを作成するのを許す 。 -f, --force 指定したリンクファイルがすでにあった場合は削除する。 -i, --interactive 指定したリンクファイルがすでにあった場合は、削除するかどうか問い 合わせを行う。 -n, --no-dereference 明示的にディレクトリにシンボリックリンクしているリンクファイルが 指定された場合、それを普通のファイルと同じように扱う。 リンク先が実際のディレクトリ (どこかへのシンボリックリンクではな い) の場合、そのディレクトリ内にリンクが作成される。しかしディレ クトリへのシンボリックリンクがリンクファイルとして指定された場合 、 2 つの可能性がある。 ln コマンドは指定されたリンクファイルを 通常のディレクトリのように扱い、その中にリンクを作成することがで きる。もう 1 つは、リンクファイルが非ディレクトリ - シンボリック リンクそのものであるとして扱うことができる。その場合には、 ln コ マンドは新しいリンクを作成する前にシンボリックリンクを削除、また はバックアップする必要がある。デフォルトでは、ディレクトリへのシ ンボリックリンクが指定された場合には、ディレクトリと同じように扱 う。 -s, --symbolic ハードリンクの代わりにシンボリックリンクを作成する。シンボリック リンクをサポートしないシステムでは、このオプションを指定すると単 にエラーメッセージを出力する。 --target-directory=DIR コマンドラインの最後の引き数として指定する代わりに、このオプショ ンでリンク先ディレクトリを指定する。 xargs(1) と一緒に使う場合に 便利である。 -v, --verbose リンクを作成する前にそれぞれの名前を出力する。 GNU バックアップオプション GNU 版のプログラム cp, mv, ln, install, patch は、指示すれば上書き、 修 正 、削除といった場合にファイルのバックアップを作成する。バックアップフ ァイルを必要とする場合は -b オプションで指示する。どういう名前にする か は --backup オプションで指定する。バックアップファイルの名前を、ファイ ル名の添字の拡張によって与えるようにしたい場合、この添字を -S オプシ ョ ンで指示する。 -b, --backup[=METHOD] 上書きもしくは削除の必要がある場合にはファイルのバックアップを作 成する。 -b は引き数をとらない点に注意すること。 -S SUFFIX, --suffix=SUFFIX SUFFIX をバックアップファイルそれぞれに付け加える。このオプシ ョ ンが指定されていない場合、環境変数 SIMPLE_BACKUP_SUFFIX に設定さ れている値が使われる。 SIMPLE_BACKUP_SUFFIX が設定されていない場 合、デフォルトは ‘~’ である。 -V METHOD, --version-control=METHOD こ のオプションは推奨されない。代わりに --backup=METHOD を使うこ と。 バックアップファイルの命名方法を指定する。 METHOD 引き数と し て ‘numbered’ (または ‘t’)、‘existing’ (または ‘nil’)、 ‘never’ (ま たは ‘simple’) を指定できる。このオプションが指定されていない 場 合、環境変数 VERSION_CONTROL の値が使われる。 VERSION_CONTROL が 設定されていない場合、デフォルトのバックアップタイプ は ‘exist- ing’ である。 このオプションは Emacs 変数の ‘version-control’ に対応している。 有効な METHOD は (他と重複しない短縮形が使える): t, numbered 常に番号の添字を持つバックアップが作られる。 nil, existing 番号の添字を持つバックアップがすでにある場合には番号の 添 字 を持つバックアップを、そうでない場合には単純なバックア ップを作成する。 never, simple 常に単純なバックアップが作られる。 GNU 標準オプション --help 標準出力に使用方法のメッセージを出力して正常終了する。 --version 標準出力にバージョン情報を出力して正常終了する。 -- オプションリストを終了する。 環境変数 変数 LANG, LC_ALL, LC_CTYPE, LC_MESSAGES が通常の意味を持つ。 準拠 POSIX 1003.2 に準拠する。しかし、POSIX 1003.2 (1996) ではソフトリンクに つ い て 触 れ て いない。ソフトリンクは BSD により持ち込まれ、System V release 3 (そしてそれ以前) のシステムでは無い。 関連項目 ls(1), rm(1), link(2), lstat(2), open(2), readlink(2), stat(2), unlink(2) 注意 このページでは fileutils-4.1 パッケージでの ln コマンドについて説明して いる。その他のバージョンでは少し違いがあるかもしれない。修正や 追 加 は aeb@cwi.nl, aw@mail1.bet1.puv.fi, ragnar@ragnar-hojland.com 宛てにメー ルで連絡してほしい。プログラムのバグについては bug-fileutils@gnu.org へ 報告してほしい。 GNU fileutils 4.1 18 June 2002 LN(1)
LN(1) User Commands LN(1)
NAME
ln - make links between files
SYNOPSIS
ln [OPTION]... [-T] TARGET LINK_NAME (1st form)
ln [OPTION]... TARGET (2nd form)
ln [OPTION]... TARGET... DIRECTORY (3rd form)
ln [OPTION]... -t DIRECTORY TARGET... (4th form)
DESCRIPTION
In the 1st form, create a link to TARGET with the name LINK_NAME. In
the 2nd form, create a link to TARGET in the current directory. In the
3rd and 4th forms, create links to each TARGET in DIRECTORY. Create
hard links by default, symbolic links with --symbolic. When creating
hard links, each TARGET must exist. Symbolic links can hold arbitrary
text; if later resolved, a relative link is interpreted in relation to
its parent directory.
Mandatory arguments to long options are mandatory for short options
too.
--backup[=CONTROL]
make a backup of each existing destination file
-b like --backup but does not accept an argument
-d, -F, --directory
allow the superuser to attempt to hard link directories (note:
will probably fail due to system restrictions, even for the
superuser)
-f, --force
remove existing destination files
-i, --interactive
prompt whether to remove destinations
-L, --logical
make hard links to symbolic link references
-n, --no-dereference
treat destination that is a symlink to a directory as if it were
a normal file
-P, --physical
make hard links directly to symbolic links
-s, --symbolic
make symbolic links instead of hard links
-S, --suffix=SUFFIX
override the usual backup suffix
-t, --target-directory=DIRECTORY
specify the DIRECTORY in which to create the links
-T, --no-target-directory
treat LINK_NAME as a normal file
-v, --verbose
print name of each linked file
--help display this help and exit
--version
output version information and exit
The backup suffix is ‘~’, unless set with --suffix or SIM-
PLE_BACKUP_SUFFIX. The version control method may be selected via the
--backup option or through the VERSION_CONTROL environment variable.
Here are the values:
Using -s ignores -L and -P. Otherwise, the last option specified con-
trols behavior when the source is a symbolic link, defaulting to -P.
none, off
never make backups (even if --backup is given)
numbered, t
make numbered backups
existing, nil
numbered if numbered backups exist, simple otherwise
simple, never
always make simple backups
AUTHOR
Written by Mike Parker and David MacKenzie.
REPORTING BUGS
Report ln bugs to bug-coreutils@gnu.org
GNU coreutils home page:
コロナウイルスの日ごとの感染者数・死者数をグラフ化してみました。どの国が増加傾向にあり、どの国が終息に向かっているかを視覚化しています。
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa