Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
hheedat
V2EX  ›  Linux

Linux 按照 inode 查文件的链接个数,为何查不到足量的文件?

  •  
  •   hheedat · Jan 3, 2020 · 3160 views
    This topic created in 2359 days ago, the information mentioned may be changed or developed.

    首先,我自己建立两个文件

    $ touch file1
    $ ln file1 file2
    $ ll -i
    
    1946247743 -rw-rw-r--  2 worker worker    0 Jan  3 19:43 file1
    1946247743 -rw-rw-r--  2 worker worker    0 Jan  3 19:43 file2
    1678585980 drwxrwxr-x 51 worker worker 4096 Aug 16  2018 website
    
    $ sudo find / -inum 1946247743
    /home/services/file1
    /home/services/file2
    
    $ sudo find / -inum 1678585980
    /home/services/website
    
    

    1946247743 可以找到对应的两个文件

    但是 1678585980 显示有 51 个链接个数,但是却只能找到一个文件,这是为啥?

    proxy

    3 replies    2020-01-04 09:51:23 +08:00
    codehz
        1
    codehz  
       Jan 3, 2020   ❤️ 1
    因为它是目录啊,每个子目录都会有一个..
    hheedat
        2
    hheedat  
    OP
       Jan 3, 2020
    @codehz 试了下还真是,看来我没有理解这个的原理,我找资料再看看吧[捂脸]
    scriptB0y
        3
    scriptB0y  
       Jan 4, 2020 via iPhone
    贴一个我之前写的 https://www.kawabangga.com/posts/3561
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2446 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 11:04 · PVG 19:04 · LAX 04:04 · JFK 07:04
    ♥ Do have faith in what you're doing.