云计算学习路线教程大纲课件:文件链接

发布时间:2020-06-22 19:27:13 作者:wx5d6de969e8c0b
来源:网络 阅读:162

云计算学习路线教程大纲课件:文件链接

====================================================================================

软链接 或 符号链接

硬链接

一、符号链接 symbolic link 软连接

[root@tianyun ~]# echo 111 > /file1

[root@tianyun ~]# ln -s /file1 /home/file11

[root@tianyun ~]# ll /home/file11

lrwxrwxrwx 1 root root 6 Dec 20 17:58 /home/file11 -> /file1

[root@tianyun ~]# ll -i /file1 /home/file11

4599081 -rw-r--r-- 1 root root 4 Dec 20 17:57 /file1

135 lrwxrwxrwx 1 root root 6 Dec 20 17:58 /home/file11 -> /file1

[root@tianyun ~]# cat /file1

111

[root@tianyun ~]# cat /home/file11

111

[root@tianyun ~]# rm -rf /file1

[root@tianyun ~]# ll /home/file11

lrwxrwxrwx 1 root root 6 Dec 20 17:58 /home/file11 -> /file1

二、硬链接

4 /etc/file1 4 /usr/file1-h

[root@tianyun ~]# echo 222 > /file2

[root@tianyun ~]# ln /file2 /file2-h2

[root@tianyun ~]# ln /file2 /home/file2-h3

ln: failed to create hard link ‘/home/file2-h3’ => ‘/file2’: Invalid cross-device link

[root@tianyun ~]# ln /file2 /etc/file2-h4

[root@tianyun ~]# echo 222 > /file2

[root@tianyun ~]# ln /file2 /file2-h2

[root@tianyun ~]# ln /file2 /home/file2-h3

ln: failed to create hard link ‘/home/file2-h3’ => ‘/file2’: Invalid cross-device link

[root@tianyun ~]# ln /file2 /etc/file2-h4

[root@tianyun ~]# ll -i /file2 /file2-h2 /etc/file2-h4

4599081 -rw-r--r-- 3 root root 4 Dec 20 18:03 /etc/file2-h4

4599081 -rw-r--r-- 3 root root 4 Dec 20 18:03 /file2

4599081 -rw-r--r-- 3 root root 4 Dec 20 18:03 /file2-h2

把一些重要文件做多个链接

注:硬链接

  1. 不能跨文件系统(分区)

  2. 不支持目录做硬链接

[root@tianyun home]# ln /home/ /mnt

ln: “/home/”: 不允许将硬链接指向目录
警告:删除目录软链时:

mkdir /home/it1000

touch /home/it1000/file{1..10}

ln -s /home/it1000/ /var/

rm -rf /var/it1000/ 删除目录下的文件

rm -rf /var/it1000 仅删除链接文件本身

[root@tianyun ~]# ln -s /etc /home/

[root@tianyun ~]# rm -rf /home/etc/

====================================================================================

推荐阅读:
  1. 云计算学习路线教程大纲课件:部署网校系统 edusoho
  2. 云计算学习路线教程大纲课件:部署论坛系统Discuz

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

云计算学习 路线

上一篇:centos7安装elasticsearch

下一篇:MySQL 查询一个库中某一类表的总数

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》