What is the fastest way to find all the file with the same inode?

后端 未结 4 1476
余生分开走
余生分开走 2021-02-03 12:46

The only way I know is:

find /home -xdev -samefile file1

But it\'s really slow. I would like to find a tool like locate. The real

4条回答
  •  广开言路
    2021-02-03 12:54

    I know this is an old question, but many versions of find have an inum option to match a known inode number easily. You can do this with the following command:

    find . -inum 1234
    

    This will still run through all files if allowed to do-so, but once you get a match you can always stop it manually; I'm not sure if find has an option to stop after a single match (perhaps with an -exec statement?)

    This is much easier than dumping output to a file, sorting etc. and other methods, so should be used when available.

提交回复
热议问题