Linux軟硬鏈接
1、軟鏈接(符號鏈接):指向原文件文件名,通過原文件間接指向磁盤的存儲空間,進行數(shù)據(jù)讀取,刪除原文件鏈接文件不可用
ln -s f1 s1 --- -s 軟鏈接 先寫原文件再寫鏈接文件
[root@localhost ~]# ls
anaconda-ks.cfg scripts
[root@localhost ~]#
[root@localhost ~]# ln -s ./scripts/test.sh s.txt
[root@localhost ~]# ll
-rw-------. 1 root root 1564 Jul 31 2020 anaconda-ks.cfg
drwxr-xr-x 2 root root 73 Sep 22 10:57 scripts
lrwxrwxrwx 1 root root 17 Sep 23 09:07 s.txt -> ./scripts/test.sh
[root@localhost ~]#
2、硬鏈接 :與原文件指向同一塊硬盤的存儲空間,相當于一個存儲空間的兩個文件名,刪除原文件鏈接文件仍可用
ln f1 h1 ---硬鏈接
[root@localhost ~]# ln ./scripts/test.sh h.txt
[root@localhost ~]# ll
-rw-------. 1 root root 1564 Jul 31 2020 anaconda-ks.cfg
-rwxr-xr-x 2 root root 132 Jul 14 22:22 h.txt
drwxr-xr-x 2 root root 73 Sep 22 10:57 scripts
lrwxrwxrwx 1 root root 17 Sep 23 09:07 s.txt -> ./scripts/test.sh
[root@localhost ~]#
3、相對路徑:對文件位置的不完整描述,在當前路徑下搜索文件
cat f1
4、絕對路徑:從/開始表示文件所在位置
cat /mnt/f1
建議創(chuàng)建軟鏈接盡量用絕對路徑
ln -s /mnt/f1 s1

浙公網(wǎng)安備 33010602011771號