Linux硬链接和软链接(符号链接)

硬链接与软连接 :https://blog.csdn.net/u013777351/article/details/50557260

索引节点:https://blog.csdn.net/jesseyoung/article/details/42524813

硬链接:

[root@VM_0_11_centos zuo]# vi 1.txt
[root@VM_0_11_centos zuo]# ls
1.txt  Scrapy
[root@VM_0_11_centos zuo]# cp -l 1.txt 11.txt
[root@VM_0_11_centos zuo]# ls -li
total 12
131601 -rw-r--r-- 2 root root   13 May 28 23:03 11.txt
131601 -rw-r--r-- 2 root root   13 May 28 23:03 1.txt
131487 drwxr-xr-x 5 root root 4096 May 28 18:20 Scrapy
[root@VM_0_11_centos zuo]# vim 11.txt 
[root@VM_0_11_centos zuo]# more 1.txt 
hello,world!
welcome back!
[root@VM_0_11_centos zuo]# ln 1.txt 111.txt
[root@VM_0_11_centos zuo]# ls -li 
total 16
131601 -rw-r--r-- 3 root root   27 May 28 23:06 111.txt
131601 -rw-r--r-- 3 root root   27 May 28 23:06 11.txt
131601 -rw-r--r-- 3 root root   27 May 28 23:06 1.txt
131487 drwxr-xr-x 5 root root 4096 May 28 18:20 Scrapy

 

软连接:

[root@VM_0_11_centos zuo]# vi 1.txt
[root@VM_0_11_centos zuo]# cp -s 1.txt 11.txt
[root@VM_0_11_centos zuo]# ln -s 1.txt 111.txt
[root@VM_0_11_centos zuo]# ls -li
total 8
131603 lrwxrwxrwx 1 root root    5 May 28 23:09 111.txt -> 1.txt
131089 lrwxrwxrwx 1 root root    5 May 28 23:09 11.txt -> 1.txt
131601 -rw-r--r-- 1 root root   13 May 28 23:08 1.txt
131487 drwxr-xr-x 5 root root 4096 May 28 18:20 Scrapy

 

[root@VM_0_11_centos zuo]# rm -f 11.txt 
[root@VM_0_11_centos zuo]# ls -li
total 8
131603 lrwxrwxrwx 1 root root    5 May 28 23:09 111.txt -> 1.txt
131601 -rw-r--r-- 1 root root   13 May 28 23:08 1.txt
131487 drwxr-xr-x 5 root root 4096 May 28 18:20 Scrapy
[root@VM_0_11_centos zuo]# rm -f 1.txt 
[root@VM_0_11_centos zuo]# ls -li
total 4
131603 lrwxrwxrwx 1 root root    5 May 28 23:09 111.txt -> 1.txt # 1.txt 红色字体,闪动
131487 drwxr-xr-x 5 root root 4096 May 28 18:20 Scrapy

 

posted @ 2018-05-28 20:18  骑者赶路  阅读(217)  评论(0编辑  收藏  举报