Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!uvm-gen!swc From: swc@griffin.uvm.edu (The Wheel in the Sky) Newsgroups: comp.unix.questions Subject: Re: Finding links Summary: man find(1), ncheck(8) Message-ID: <1307@uvm-gen.UUCP> Date: 22 Oct 89 04:22:54 GMT References: <598@cogent.UUCP> Sender: nobody@uvm-gen.UUCP Followup-To: swc@uvm.edu Distribution: usa Organization: Division of EMBA, University of Vermont Lines: 39 In-reply-to: doug@cogent.UUCP's message of 18 Oct 89 17:33:50 GMT in article <598@cogent.UUCP> (Doug Perlich) writes: >I might be located in directory xyz and I think "Hmm, I want to know what >the name of the link to the file foobar is". Given one path name of a file, find all other directories entries pointing to the same file. This means all directory entries with the same inumber on the same file system as the given file name. ncheck reports all the directory entries along with the inode they point to. You can also select just a certain inode to list pathnames for. Use ls -i to get the inumber for the file you want to cross-reference. A much slower method but one that doesn't require read access to the special file uses find. This also decends the fs tree to other filesystems and across nfs mounts, but this can be prevented by cd'ing to the mount point of the filesystem containing the file and by -xdev option [-prune is documented but not yet implemented for SunOS4.0.3]. swc@kira>mkdir xyz abc swc@kira>touch xyz/foobar swc@kira>ln xyz/foobar abc/foobee swc@kira>ls -i xyz/foobar 15106 xyz/foobar swc@kira>find . -inum 15106 -xdev -ls 15106 0 -rw-r--r-- 2 root daemon 0 Oct 21 23:54 ./xyz/foobar 15106 0 -rw-r--r-- 2 root daemon 0 Oct 21 23:54 ./abc/foobee swc@kira>df xyz/foobar Filesystem kbytes used avail capacity Mounted on /dev/xd0h 494269 406091 38751 91% /home swc@kira>ncheck -a -i 15106 /dev/xd0h /dev/xd0h: 15106 /tmp/xyz/foobar 15106 /tmp/abc/foobee -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Steve Chappelow System TroubleShooter EMBA Computer Facility (swc@uvm.edu || uunet!uvm-gen!swc) (802)656-2926