国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

Linux鏈接命令的實例詳解

2019-10-26 18:54:54
字體:
來源:轉載
供稿:網友

Linux鏈接命令的實例詳解

一 語法

ln -s [源文件] [目標文件]命令英文含義:link功能描述:生成鏈接文件選項:-s 創建軟鏈接 

二 硬鏈接特征

原文件和硬鏈接文件刪除其中任何一個都沒問題。

三 硬鏈接實戰

[root@localhost ~]# cd test[root@localhost test]# lsbcd[root@localhost test]# ln bcd abc.hard[root@localhost test]# lltotal 0-rw-r--r--.2 root root 0Jul1219:31 abc.hard-rw-r--r--.2 root root 0Jul1219:31 bcd[root@localhost test]# vi bcd[root@localhost test]# cat abc.hard qwer [root@localhost test]# echo "dfd">> abc.hard [root@localhost test]# cat bcd qwer dfd[root@localhost test]# ls -i67170460 abc.hard 67170460 bcd[root@localhost test]# rm bcd rm: remove regular file ?.cd?. y[root@localhost test]# cat abc.hard qwer dfd[root@localhost test]# ll -itotal 467170460-rw-r--r--.1 root root 10Jul1220:39 abc.hard

 四 軟鏈接特征

1、把原文件刪除,軟鏈接文件無法使用。

2、雖然軟鏈接文件的權限是777,但真正的權限還是由原文件決定。

3、創建軟鏈接時,如果原文件和目標文件在一個目錄下,不用寫絕對路徑,否則原文件和目標文件必須寫絕對路徑。所以原文件一定要寫絕對路徑。

五 實戰

[root@localhost test]# lsabc[root@localhost test]# ln -s abc abc.soft[root@localhost test]# lltotal 0-rw-r--r--.1 root root 0Jul1220:42 abclrwxrwxrwx.1 root root 3Jul1220:55 abc.soft -> abc[root@localhost test]#in abc abc.hard-bash: syntax error near unexpected token `in'[root@localhost test]# ln abc abc.hard[root@localhost test]# lltotal 0-rw-r--r--. 2 root root 0 Jul 12 20:42 abc-rw-r--r--. 2 root root 0 Jul 12 20:42 abc.hardlrwxrwxrwx. 1 root root 3 Jul 12 20:55 abc.soft -> abc[root@localhost test]# ls -i67170460 abc 67170460 abc.hard 67170462 abc.soft[root@localhost test]# echo 111 >>abc[root@localhost test]# cat abc.soft 111[root@localhost test]# cat abc.hard 111[root@localhost test]# echo 222 >> abc.soft [root@localhost test]# cat abc111222[root@localhost test]# cat abc.soft 111222[root@localhost test]# rm -rf abc[root@localhost test]# lltotal 4-rw-r--r--. 1 root root 8 Jul 12 20:59 abc.hardlrwxrwxrwx. 1 root root 3 Jul 12 20:55 abc.soft -> abc[root@localhost test]# cat abc.hard 111222[root@localhost test]# rm -rf abc.soft [root@localhost test]# lltotal 4-rw-r--r--. 1 root root 8 Jul 12 20:59 abc.hard[root@localhost test]# touch abc[root@localhost test]# ln -s abc.soft[root@localhost test]# lsabc abc.hard abc.soft[root@localhost test]# ll -itotal 467170462 -rw-r--r--. 1 root root 0 Jul 12 21:01 abc67170460 -rw-r--r--. 1 root root 8 Jul 12 20:59 abc.hard67170463 lrwxrwxrwx. 1 root root 8 Jul 12 21:01 abc.soft -> abc.soft[root@localhost test]# rm -rf *[root@localhost test]# lltotal 0[root@localhost test]# touch abc[root@localhost test]# ln -s abc abc.soft[root@localhost test]# lltotal 0-rw-r--r--. 1 root root 0 Jul 12 21:05 abclrwxrwxrwx. 1 root root 3 Jul 12 21:05 abc.soft -> abc[root@localhost test]# ln -s abc /tmp/ab.soft[root@localhost test]# ll /tmptotal 0lrwxrwxrwx. 1 root root 3 Jul 12 21:06 ab.soft -> abcdrwxr-xr-x. 3 root root 16 Jul 12 19:33 japan[root@localhost test]# ll /tmptotal 0lrwxrwxrwx. 1 root root 3 Jul 12 21:06 ab.soft -> abcdrwxr-xr-x. 3 root root 16 Jul 12 19:33 japan[root@localhost test]# rm -rf /tmp/ab.soft[root@localhost test]# ln -s /root/test/abc /tmp/ab.soft[root@localhost test]# ll /tmptotal 0lrwxrwxrwx. 1 root root 14 Jul 12 21:08 ab.soft -> /root/test/abcdrwxr-xr-x. 3 root root 16 Jul 12 19:33 japan            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 芦山县| 桦南县| 汉阴县| 朔州市| 布拖县| 乡宁县| 朝阳市| 合山市| 昌吉市| 绩溪县| 奉化市| 新邵县| 泰来县| 鹤岗市| 永登县| 社旗县| 凤翔县| 吉林市| 吴堡县| 宣城市| 湾仔区| 偏关县| 仪陇县| 大埔区| 专栏| 正蓝旗| 武汉市| 定州市| 车致| 民乐县| 科技| 安乡县| 德令哈市| 阿拉善右旗| 秭归县| 老河口市| 万年县| 景宁| 胶州市| 砚山县| 西乌珠穆沁旗|