您的位置:首页 > 运维架构 > Linux

linux的软链接

2016-01-18 15:55 405 查看
linux下的软链接类似于windows下的快捷方式。

ln -s a b 中的 a 就是源文件,b是链接文件名(快捷方式),其作用是当进入b目录,实际上是链接进入了a目录

执行命令的时候,应该是a目录已经建立,目录b(快捷方式)没有建立。

<span style="white-space:pre"> </span>a /mnt/test 此目录必须已经建立
<span style="white-space:pre"> </span>b /data/test 此目录<span style="font-family: helvetica, tahoma, arial, sans-serif;">必须</span><span style="font-family: helvetica, tahoma, arial, sans-serif;">没有建立,也就是说/data没有test这个目录。</span>
<span style="white-space:pre"> </span>ln -sf /mnt/test /data/test
这样进入/data/test,实际上是进入/mnt/test
<p style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; clear: both; height: auto; overflow: hidden; color: rgb(85, 85, 85); font-size: 14px; font-family: helvetica, tahoma, arial, sans-serif; line-height: 25px;">效果如下:<span style="font-size:14px;"> </span></p><p style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; clear: both; height: auto; overflow: hidden; color: rgb(85, 85, 85); font-family: menlo;"><span style="font-size:14px;">lrwxr-xr-x  1 root  wheel  9 Dec  2 17:57 /data/test -> /mnt/test</span></p>

如何删除软链接:

rm -rf b 注意不是rm
-rf b/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: