linux索引節點及值(弄清十分必要)
各位看官,
[root@luozhonghua aaa]# ls -l test.c
-rw-r--r--. 1 root root 3 Aug 1 07:49 test.c #看加粗1 原始test.c文件索引節點值為1,也就是每個文件第一次生成時候都是唯一的1值[root@luozhonghua aaa]# ln test.c test1.c #硬鏈接文件test1.c
[root@luozhonghua aaa]# ls -li test*
262594 -rw-r--r--. 2 root root 3 Aug 1 07:49 test1.c
262594 -rw-r--r--. 2 root root 3 Aug 1 07:49 test.c #這裏為什麼變成2呢,是因為硬鏈接時自動增1,其實很好理解,linux文件係統就是一個樹節點的結構,想想就清楚了
#再看,如果我刪除 test.c 看看
[root@luozhonghua aaa]# rm -rf test.c
[root@luozhonghua aaa]# ls -li test*
262594 -rw-r--r--. 1 root root 3 Aug 1 07:49 test1.c #變回來了吧,注意很多資料說這個值不變,還是2,是錯誤的。
總而言之,linux就是一個樹節點係統,由樹節點文件組成,操作一切文件都與樹的邏輯相同
最後更新:2017-04-03 05:39:38