[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A direct way to find hard links?



Andrey Andreev wrote:

> Andrey Andreev wrote:
>> Adam Funk wrote:
>>>When I see in a listing that a file has one or more other hard links, for
>>>example:
>>>is there any direct way to find the other /path/to/files that point to
>>>the same inodes?
>> Something like in bash:
>> 
>> for (( i=2 ; $i < 10 ; i = $i +1 )) ; do find . -links $i -and -type f
>> ; done
>> 
>> I assume my bash is dreadful, so if you have a prettier solution just
>> tell me.
> 
> I knew it looked too ugly :)
> 
>  find . -links +1 -type f -ls

I may have written my question misleadingly.  What I meant was:

For a given, specific path/file X, I know that X is one of the pointers to
inode Y, and I want to find the other path/filenames that point to the same
inode Y.  Is there any efficient way to make a command like the following?
  $ list_all_hard_links /path/to/x

I strongly suspect that using something based on this
  $ ls -li /path/to/x
  $ find /try/this/path -inum 1234
is the only way.



Reply to: