為啥要用軟連接?
跟cp有啥差別?cp不香嗎?
優(yōu)點:
1.相當于 Windows下的快捷方式,方便操作
2.節(jié)約空間
ln:Link鏈接,分軟鏈接(常用)和硬接(默認)
常見參數:不加參數即為硬鏈接,加上-s參數即為軟鏈接,
軟鏈接的作用類似快捷方式
常見用法:ln -s TARGET DIRECTORY
root 02:59:03 ~
$ mkdir ln
root 02:59:33 ~
$ ls -lh
total 54M
-rw-r--r-- 1 root root 0 May 27 13:16 a.txt
drwxr-xr-x 6 root root 4.0K May 27 13:16 data
drwxr-xr-x 2 root root 4.0K May 28 02:59 ln
drwxr-xr-x 17 root root 4.0K May 26 14:03 miniconda3
-rw-r--r-- 1 root root 54M Mar 2 17:39 rstudio-server-1.4.1106-amd64.deb
drwxr-xr-x 2 root root 4.0K May 26 13:34 software
drwxr-xr-x 2 root root 4.0K May 26 11:52 temp
drwxr-xr-x 3 root root 4.0K May 28 02:49 test_file1
-rw-r--r-- 1 root root 0 May 28 02:34 test_file3
root 02:59:37 ~
$ ln -s a.txt ln
root 02:59:55 ~
$ cd ln
root 03:00:07 ~/ln
$ ls
a.txt
root 03:00:10 ~/ln
$ ln -s /root/miniconda3/ ./
root 03:01:53 ~/ln
$ ls -lh
total 0
lrwxrwxrwx 1 root root 5 May 28 02:59 a.txt -> a.txt
lrwxrwxrwx 1 root root 17 May 28 03:01 miniconda3 -> /root/miniconda3/
root 03:01:58 ~/ln
$ ls -s /root/a.txt ./
0 /root/a.txt
./:
total 0
0 a.txt 0 miniconda3
root 03:03:17 ~/ln
$ ls -lh
total 0
lrwxrwxrwx 1 root root 5 May 28 02:59 a.txt -> a.txt
lrwxrwxrwx 1 root root 17 May 28 03:01 miniconda3 -> /root/miniconda3/
root 03:03:29 ~/ln
$