How can I find where a link leads to

Mark J. Miller mark at elsie.UUCP
Wed Jan 23 23:41:56 AEST 1985


> 
> Granted find is the only way to find all of the links, but
> there is a special case for which there is an easier way.
> If all of the links are suspected to be in one directory
> ( like all of the links to /bin/ex ) then I find out the inode 
> number with ls -i and do an ls -i on the directory in question
> with the output piped to "grep '^#'" where # is the inode number.
> You can tell if you got all of the links by the link count.
> 
> Mike @ AMDCAD

Actually, you will (probably) need to use egrep and be carefull because the
ls -i call pads space characters at the begining of each line so that the
file names align. A more general way to do the deed would be:

	ls -i | awk '{ if ($1 == #) print $0}'

It would be nice if one could use "ls -iR" and search subdirectories, but
the '-R' option of ls doesn't cause the full path names to be printed.

-- 
Mark J. Miller
NIH/NCI/DCE/LEC
UUCP:	decvax!harpo!seismo!elsie!mark
Phone:	(301) 496-5688



More information about the Comp.unix mailing list