软链接文件
命令格式:
代码:
ln [-s] source_path target_path

硬链接文件
info ln 命令告诉您,硬链接是已存在文件的另一个名字,硬连接的命令是
代码:
ln -d existfile newfile
引用:
硬链接文件有两个限制
1、不允许给目录创建硬链接;
2、只有在同一文件系统中的文件之间才能创建链接。


代码:
$ ln httpd.conf httpd1.conf
$ ln -s httpd.conf httpd2.conf
第一条为硬链接,第二条为软链接
代码:
$ ls -li
代码:
总用量 80
1077669 -rw-r--r-- 2 sam adm 34890 10 月 31 00:57 httpd1.conf
1077668 lrwxrwxrwx 1 sam adm 10 10 月 31 00:58 httpd2.conf
-> httpd.conf
1077669 -rw-r--r-- 2 sam adm 34890 10 月 31 00:57 httpd.conf
可以看到,使用ls -li,软连接只产生了10 字节的快捷而已,硬连接却实实在在的的拷贝。最
前面的inode 硬链接和源文件是一样的,而软链接不一样,具体看一下回复这话有误,但先这
么理解,具体请看下面的回复
对 http1.conf 进行编辑,可以发现httpd.conf 也发生了一样的变化
代码:
$ rm httpd.conf
现在删除链接的源文件,来比较不同之处
代码:
$ ls -l
总用量 44
drw-r--r-- 2 sam adm 4096 10 月 30 20:14 file6
-rw-r--r-- 1 sam adm 34890 10 月 31 00:57 httpd1.conf
lrwxrwxrwx 1 sam adm 10 10 月 31 00:58 httpd2.conf ->
httpd.conf
发现,httpd2.conf 实际已经不存在了,是断链,而httpd1.conf 变也了普通文件
转一个:更好理解