How do you find the symbolic links to files.

John F. Haugh II jfh at rpp386.cactus.org
Mon Nov 19 02:30:08 AEST 1990


In article <1990Nov17.203012.28052 at maverick.ksu.ksu.edu> jwindley at matt.ksu.ksu.edu (Jay Windley) writes:
>tcurrey at x102a.ess.harris.com (currey tom 76327) writes:
>>>    How do you find the # of and locations of all links to a file?
>chuck at trantor.harris-atd.com (Chuck Musciano) writes:
>>     This is an easy one.  You cannot.
>>     
>>     Well, sort of.  You cannot determine which hard links to a file exist
>>without examining all the directories in a given file system, looking for
>>the specific inode of the file in question.  Does anyone know of a tool to
>>do this?
>
>SunOS% find /foo -inum <num> -print
>
>where /foo is the mount point of the filesystem and <num> is the inode
>number will display the paths of all hard links to an inode.

Lest I be accused of somehow "breaking" find(1), the above command will
not work if there are any directories mounted on "/foo" which contain
a file with the same i-number.  Since "/" is a directory which is
frequently mounted on (;-), I think this is a real problem.

The -xdev option can be used to keep find on the same file system, but
it is not a "standard" option.
-- 
John F. Haugh II                             UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 832-8832                           Domain: jfh at rpp386.cactus.org
"SCCS, the source motel!  Programs check in and never check out!"
		-- Ken Thompson



More information about the Comp.unix.internals mailing list