Linux软链接与硬链接
2015-12-25 07:32
549 查看
简介:Linux的链接文件分为软链接与硬链接理解:1.软链接可以跨分区,但源文件不可删除
2.硬链接不可以跨分区,但可以将源文件删除
[root@localhost ~]# cd /tmp/ [root@localhost tmp]# touch a b c [root@localhost tmp]# ln -s a aa [root@localhost tmp]# ln b bb [root@localhost tmp]# ls -il total 64 65453 -rw-r--r-- 1 root root 0 Dec 18 19:23 a 65456 lrwxrwxrwx 1 root root 1 Dec 18 19:24 aa -> a #可以看出软链接文件是不同的inode 65454 -rw-r--r-- 2 root root 0 Dec 18 19:23 b 65454 -rw-r--r-- 2 root root 0 Dec 18 19:23 bb #硬链接的inode相同 65455 -rw-r--r-- 1 root root 0 Dec 18 19:23 c [root@localhost tmp]# rm a b rm: remove regular empty file `a'? y rm: remove regular empty file `b'? y [root@localhost tmp]# ls -li total 56 65456 lrwxrwxrwx 1 root root 1 Dec 18 19:24 aa -> a #此时链接文件损坏,文件闪烁 65454 -rw-r--r-- 1 root root 0 Dec 18 19:23 bb #删除源文件b,bb文件不受影响 65455 -rw-r--r-- 1 root root 0 Dec 18 19:23 c
拓展:如何查找出相同iNode的文件呢?(提示通过find -inum)
本文出自 “人生一首断章” 博客,请务必保留此出处http://duanzhang.blog.51cto.com/9200924/1728090
相关文章推荐
- Linux下Nagios的安装与配置
- Linux基本命令个人笔记精华
- Centos7下搭建LAMP平台环境 (转载)
- linux下最简单的禁ping方法
- 工具-github在linux下面没有git push报错
- 扩大VMware虚拟机中linux硬盘空间
- windows 下SVN搭建(linux下晚些记录。。。)
- Linux启动过程详解
- Linux 安装mysql5.7后root密码问题
- 每天一个linux之rm命令
- 以 Linux 的方式庆祝圣诞节
- Linux服务器SNMP常用OID
- 在CentOS7上安装python3x+django1.8的运行环境
- Linux 安装 Lepus笔记
- Linux 学了很多,但是感觉还是没有把这些知识点连成一片!!查看Linux 版本内核之类的
- kali linux 2.0 启动metasploit framework 方法,查看当前启动服务
- 在SUSE linux上编译内核
- linux 命令
- Linux User's Manual IOSTAT
- 今日笔记Linux命令的详解