永久連結 軟連結

來源:互聯網
上載者:User
永久連結
[oracle@dcm ~]$ ln original.file hard.link

軟連結
[oracle@dcm ~]$ ln -s original.file soft.link

[oracle@dcm ~]$ ls -l
-rw-r--r-- 2 oracle oinstall    4 Jul 14 17:21 original.file
-rw-r--r-- 2 oracle oinstall    4 Jul 14 17:21 hard.link
lrwxrwxrwx 1 oracle oinstall   13 Jul 14 17:23 soft.link -> original.file

連結數只是和永久連結相關的一個概念
從連結檔案可以跟蹤到軟連結的指向(無法反向跟蹤)

---------------
由於inode這種檔案系統結構不是雙向的,不能尋找一個inode被reference了多少次。我們只能通過一些技巧來跟蹤永久連結。
1. 通過連結數,我們可以知道哪個檔案有永久連結(大於1)
2. 尋找該檔案的inode id
[oracle@dcm ~]$ ls -i hard.link
1573158 hard.link
3. 通過inode id尋找檔案(如果需要遍曆的目錄很多,速度自然可想而知)
[oracle@dcm ~]$ find -inum 1573158
./hard.link
./original.file
4. 永久連結本質上是多個dentry指向同一個inode,所以並沒有主從之分,每個dentry都是平等的。

尋找系統中所有永久連結數大於2的檔案:#find / -links +2 -type f

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.