
使用“ln -s snmp_5.4.3~dfsg-2.8+deb7u1_amd64.deb /test.link”命令可以在根目录下创建一个snmp的连接。
使用“ls /”可以看到新创建的连接文件“test.link”。
使用“ln -d snmp_5.4.3~dfsg-2.8+deb7u1_amd64.deb /test.block.link”命令,可以创建一个硬链接。
5
软连接相当于windows的快捷方式,而硬链接是将源文件又拷贝了一份。
Linux下取消软连接,做个案例来说明:
1.先建立一个软连接
[root@rekfan.com test]# ls -il总计 0
1491138 -rw-r–r– 1 root root 48 07-14 14:17 file1
1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2
1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2hand
#建立file1和file1soft软连接
[root@rekfan.com test]# ln -s file1 file1soft
[root@rekfan.com test]# ls -il
总计 0
1491138 -rw-r–r– 1 root root 48 07-14 14:17 file1
1491140 lrwxrwxrwx 1 root root 5 07-14 14:24 file1soft -> file1
1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2
1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2hand
2.删除上面建立的软连接
[root@rekfan.com test]# ls -il总计 0
1491138 -rw-r–r– 1 root root 0 07-14 14:17 file1
1491140 lrwxrwxrwx 1 root root 5 07-14 14:24 file1soft -> file1
1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2
1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2hand
#删除软连接
[root@rekfan.com test]# rm -rf file1soft
[root@rekfan.com test]# ls -il
总计 0
1491138 -rw-r–r– 1 root root 0 07-14 14:17 file1
1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2
1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2hand
linux in-s命令用于创建软链接,步骤如下:
1、首先,连接相应linux主机,进入到linux命令行状态下,等待输入shell指令。
2、在linux命令行下输入shell指令:ln -s /home/httpd/html/test /var/test 。
3、键盘按“回车键”运行shell指令,此时会看到成功对/home/httpd/html/test目录创建了一个软链接到/var/test。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)