finding the missing links
David Elliott
dce at Solbourne.COM
Wed May 31 10:07:13 AEST 1989
In article <2654 at erikb.cs.vu.nl> erikb at cs.vu.nl (Erik Baalbergen) writes:
>>I do a 'ls -l /tmp' and see that yyy has 3 links. How can I find the other
>>two files?
> find / -inum <inum> -links 3 -user <your user name> -print
>Unfortunately, it is not possible to use the device number to 'find' files.
>The combination of device and inode number uniquely determines a file within
>a (non-network-file-system) UNIX system. Perhaps we should equip any future
>'find' program with the "-dnum <dnum>" primary expression.
While it's a nice idea, it may not be necessary.
If you have 4.3BSD or a recent SunOS, your find command has the option
-xdev, which prevents it from looking at files in other filesystems
(hard links can't cross filesystems), so you can say
find <root of filesystem> -xdev -inum <inum> -print
To find the root of the filesystem, just use df on the file and
pipe the output through an awk or sed script to extract the name
(watch out for df printing long names, especially NFS filesystems,
since it will produce extra lines).
--
David Elliott dce at Solbourne.COM
...!{boulder,nbires,sun}!stan!dce
More information about the Comp.unix.questions
mailing list