`
mmdev
  • 浏览: 12935654 次
  • 性别: Icon_minigender_1
  • 来自: 大连
文章分类
社区版块
存档分类
最新评论

Linux学习笔记<基本命令2>

 
阅读更多
软链接与硬链接

软连接:
软连接类似于我们windows系统的“快捷方式”
那么在windows下之所以要设置快捷方式,就是因为有些文件放置的位置不容易找到,我们就会在桌面创建一个快捷方式。
那么在linux下的软链接,我想主要是文件名过长,不便于输入。因为linux下对文件对文件操作一般要输入文件名,不像windows下面无所谓文件名的长短,鼠标点击即可完成各中操作。
创建一个软链接
[root@localhost test]# ln -s ruanlianjie.abc /hzh/test/rlj.soft
   对当前目录下的ruanlianjie.abc文件,在/hzh/test/目录下创建一个软链接,名为rlj.soft
[root@localhost test]# ll
总用量 36
lrwxrwxrwx 1 root root 15 3月 19 20:57rlj.soft -> ruanlianjie.abc
-rw-r--r-- 1 root root 28 3月 19 20:57 ruanlianjie.abc
现在就可以对软件链接,进行操作了,
[root@localhost test]#vi rlj.soft 编辑rlj.soft文件,其实也就是编辑ruanlianjie.abc文件
硬连接:
硬连接相当于把原文件拷贝了一份,唯一特殊的地方就是,两个文件是同步的。当你对其中一个文件进行修改时,另一个文件也就会同步更新你的修改。有什么好处,你懂的!
下面创建一个硬链接:
[root@localhost test]#lnyinglianjie.abc /hzh/test/ylj.hard
   对yinglianjie.abc文件在/hzh/test/目录下创建一个硬链接文件ylj.hard
[root@localhost test]# ll
-rw-r--r-- 2 root root 0 3月 19 21:08 yinglianjie.abc
-rw-r--r-- 2 root root 0 3月 19 21:08 ylj.hard

[root@localhost test]#viylj.hard 对硬链接ylj.hard文件时行修改并保存
[root@localhost test]# ll
-rw-r--r-- 2 root root 143月 19 21:09yinglianjie.abc 我们会发现yinglianjie.abc也被同步修改了
-rw-r--r-- 2 root root 14 3月 19 21:09 ylj.hard
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics