码迷,mamicode.com
首页 > 系统相关 > 详细

Linux软硬连接

时间:2018-10-04 18:58:18      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:错误   tcl   连接   删除   root   check   导致   一个   nod   

  曾经对软硬连接一直搞不明白,关键是怕操作错误。

硬链接不能跨区实现连接,硬链接是对原始文件的镜像,同一个inode,软连接是快捷方式,inode保存的是快捷方式的。原始文件删除,导致软连接文件无效。

01、硬链接

技术分享图片

 02、软连接

技术分享图片

对目录的链接

[root@dzswj-test tmp]#ll
total 16
drwxr-xr-x 3 root  root  4096 Jul 12 14:44 gitdev
drwxr-xr-x 2 resin resin 4096 Aug 10 10:59 hsperfdata_resin
drwx------ 2 gdm   gdm   4096 Oct  4 14:41 orbit-gdm
drwx------ 2 gdm   gdm   4096 Oct  4 14:42 pulse-D9BRMMarTPJX
[root@dzswj-test tmp]#
[root@dzswj-test tmp]#
[root@dzswj-test tmp]#ln -sv /usr/local/bin  .    //软连接,方原始路径需写绝对路径
`./bin -> `/usr/local/bin
[root@dzswj-test tmp]#ll
total 16
lrwxrwxrwx 1 root  root    14 Oct  4 18:15 bin -> /usr/local/bin   //清晰看到链接指向
drwxr-xr-x 3 root  root  4096 Jul 12 14:44 gitdev
drwxr-xr-x 2 resin resin 4096 Aug 10 10:59 hsperfdata_resin
drwx------ 2 gdm   gdm   4096 Oct  4 14:41 orbit-gdm
drwx------ 2 gdm   gdm   4096 Oct  4 14:42 pulse-D9BRMMarTPJX
[root@dzswj-test tmp]#ll bin/  bin目录下的文件
total 29048
-rwxr-xr-x. 1 root root  266821 Apr 15  2016 memcached
-rwxr-xr-x  1 root root 1234088 Aug 15  2016 rar
-rwxr-xr-x  1 root root 5587865 May 16  2016 redis-benchmark
-rwxr-xr-x  1 root root   22185 May 16  2016 redis-check-aof
-rwxr-xr-x  1 root root 7823836 May 16  2016 redis-check-rdb
-rwxr-xr-x  1 root root 5714129 May 16  2016 redis-cli
lrwxrwxrwx  1 root root      12 May 16  2016 redis-sentinel -> redis-server
-rwxr-xr-x  1 root root 7823836 May 16  2016 redis-server
-rwxr-xr-x  1 root root    8807 May 26  2016 tclsh8.5
-rwxr-xr-x  1 root root 1234088 Aug 15  2016 unrar

Linux软硬连接

标签:错误   tcl   连接   删除   root   check   导致   一个   nod   

原文地址:https://www.cnblogs.com/xiaochina/p/9742278.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!