link
rose1 发表于 2020-09-21 09:08浏览次数:
在类似Unix的操作系统上,link命令将文件与文件系统中的文件名相关联。
本文档描述了链接的GNU / Linux版本。
On Unix-like operating systems, The link command associates a file with a file name in a file system.
This document describes the GNU/Linux version of link.
目录:
1 link 运行系统环境
2 link 说明
3 link 语法
4 link 例子
link 运行系统环境
link 说明
该link命令创建一个硬链接名为FILE2共享相同索引节点的现有文件FILE1。由于FILE1和FILE2共享同一索引节点,因此它们将指向磁盘上的相同数据,并且修改一个在功能上与修改另一个在功能上相同。
这不同于创建指向文件的“软” 符号链接,后者创建其自己的索引节点,因此不会直接指向相同的数据。
例如,用户不能创建链接到目录的硬链接。但这可以使用符号链接来完成。
The link command creates a hard link named FILE2 which shares the same index node as the existing file FILE1. Since FILE1 and FILE2 share the same index node, they will point to the same data on the disk, and modifying one will be functionally the same as modifying the other.
This is distinct from creating a "soft" symbolic link to a file, which creates its own index node and therefore does not directly point to the same data.
For example, a user cannot create a hard link which links to a directory; but this can be accomplished using a symbolic link.
link 语法
link FILE1 FILE2
link OPTION
选件
--help
|
显示帮助并退出。
|
--version
|
显示版本信息,然后退出。
|
link FILE1 FILE2
link OPTION
Options
--help
|
display help and exit.
|
--version
|
display version information, and exit.
|
link 例子
link computer.txt hope.txt
上面的示例将创建链接到文件computer.txt的文件hope.txt。这些文件之一发生的任何更改都会影响另一个文件或链接。
link computer.txt hope.txt
The above example would create the file hope.txt linked to the file computer.txt. Any changes that occurred with either of these files would affect the other file or link.