Find hard links?

Robert P. J. Day rpjday at mindspring.com
Wed Feb 2 12:31:56 UTC 2005


On Wed, 2 Feb 2005, Paul Howarth wrote:

> D. D. Brierton wrote:
> > I know that you can use find like so:
> >
> > find -type l
> >
> > to find symbolic links, but does anyone know how one finds hard links?
>
> Try:
>
> $ find /some/directory -links +1 -type f -ls
>
> The files with the same numbers in the left hand column are hard
> linked to each other.

as another tidbit of info, you can see the i-number of a file with:

  $ ls -i <filename>

then use find to find *all* hardlinks to the same file with:

  $ find <dir> -inum <inumber>

just make sure you do it within the same filesystem.  but again, this
isn't exactly what the OP was asking.  the original question is still,
in a sense, kind of meaningless.

rday




More information about the users mailing list