linux系统中如何建立与删除软连接(方便快捷使用,大量节约时间)

建立软连接可以给我们带来很大的好处,举个例子,咱们在访问深度较为长的文件或文件夹时,可以选择直接使用软连接,让我们实现能快速到达文件所在位置的效果

首先,咱们需要到达的目的地址是:/usr/local/neo4j/neo4j-community-3.2.3/bin

代码如下:

root@kkc-virtual-machine:~# cd /usr/local/neo4j/neo4j-community-3.2.3/bin/ root@kkc-virtual-machine:/usr/local/neo4j/neo4j-community-3.2.3/bin# ll 总用量 56 drwxr-xr-x 3 dnsmasq nogroup 4096 7月 27 17:21 ./ drwxr-xr-x 11 dnsmasq nogroup 4096 8月 11 21:15 ../ -rwxr-xr-x 1 dnsmasq nogroup 1991 614 20:50 cypher-shell* -rwxr-xr-x 1 dnsmasq nogroup 14339 727 17:17 neo4j* -rwxr-xr-x 1 dnsmasq nogroup 5657 727 17:17 neo4j-admin* -rwxr-xr-x 1 dnsmasq nogroup 5637 727 17:17 neo4j-import* -rwxr-xr-x 1 dnsmasq nogroup 5636 727 17:17 neo4j-shell* drwxr-xr-x 2 dnsmasq nogroup 4096 8月 11 21:12 tools/ root@kkc-virtual-machine:/usr/local/neo4j/neo4j-community-3.2.3/bin#

接下来,咱们创建软连接 : ln -s /usr/local/neo4j/neo4j-community-3.2.3/bin neo4jbin

root@kkc-virtual-machine:/# ln -s /usr/local/neo4j/neo4j-community-3.2.3/bin neo4jbin root@kkc-virtual-machine:/# cd neo4jbin root@kkc-virtual-machine:/neo4jbin# ll 总用量 56 drwxr-xr-x 3 dnsmasq nogroup 4096 7月 27 17:21 ./ drwxr-xr-x 11 dnsmasq nogroup 4096 8月 11 21:15 ../ -rwxr-xr-x 1 dnsmasq nogroup 1991 614 20:50 cypher-shell* -rwxr-xr-x 1 dnsmasq nogroup 14339 727 17:17 neo4j* -rwxr-xr-x 1 dnsmasq nogroup 5657 727 17:17 neo4j-admin* -rwxr-xr-x 1 dnsmasq nogroup 5637 727 17:17 neo4j-import* -rwxr-xr-x 1 dnsmasq nogroup 5636 727 17:17 neo4j-shell* drwxr-xr-x 2 dnsmasq nogroup 4096 8月 11 21:12 tools/

上面代码显示,软连接已经建立成功!

接下来,咱们再学习下如何删除软连接:
首先,查看文件

root@kkc-virtual-machine:/# ll 总用量 105 drwxr-xr-x 24 root root 4096 816 21:28 ./ drwxr-xr-x 24 root root 4096 816 21:28 ../ drwxr-xr-x 2 root root 4096 811 15:47 bin/ drwxr-xr-x 4 root root 1024 812 09:49 boot/ drwxrwxr-x 2 root root 4096 811 15:44 cdrom/ drwxr-xr-x 18 root root 4020 816 17:15 dev/ drwxr-xr-x 132 root root 12288 816 17:15 etc/ drwxr-xr-x 4 root root 4096 811 15:46 home/ lrwxrwxrwx 1 root root 33 812 09:48 initrd.img -> boot/initrd.img-4.10.0-32-generic lrwxrwxrwx 1 root root 33 811 15:46 initrd.img.old -> boot/initrd.img-4.10.0-28-generic drwxr-xr-x 22 root root 4096 811 15:47 lib/ drwxr-xr-x 2 root root 4096 81 19:19 lib64/ drwx------ 2 root root 16384 811 15:41 lost+found/ drwxr-xr-x 3 root root 4096 811 17:12 media/ drwxr-xr-x 3 root root 4096 811 17:25 mnt/ lrwxrwxrwx 1 root root 42 816 21:28 neo4jbin -> /usr/local/neo4j/neo4j-community-3.2.3/bin/

咱们看到这一行代码:
lrwxrwxrwx 1 root root 42 8月 16 21:28 neo4jbin -> /usr/local/neo4j/neo4j-community-3.2.3/bin/

很简单,咱们直接把这个文件删除
:rm -rf neo4jbin

root@kkc-virtual-machine:/# rm -rf neo4jbin

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzjzdg.html