Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!bcm!dimacs.rutgers.edu!mips!sdd.hp.com!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!cica!news.cs.indiana.edu!ux1.cso.uiuc.edu!maverick.ksu.ksu.edu!matt.ksu.ksu.edu!jwindley From: jwindley@matt.ksu.ksu.edu (Jay Windley) Newsgroups: comp.unix.internals Subject: Re: How do you find the symbolic links to files. Message-ID: <1990Nov17.203012.28052@maverick.ksu.ksu.edu> Date: 17 Nov 90 20:30:12 GMT References: <4899@trantor.harris-atd.com> <4900@trantor.harris-atd.com> Sender: news@maverick.ksu.ksu.edu (The News Guru) Organization: Kansas State University Lines: 42 tcurrey@x102a.ess.harris.com (currey tom 76327) writes: >> How do you find the # of and locations of all links to a file? chuck@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 -print where /foo is the mount point of the filesystem and is the inode number will display the paths of all hard links to an inode. > Symbolic links are tougher. Since sym-links can span file systems and >NFS, you are not guaranteed to ever find all of them, only the ones in files >systems you have access to. You need to use find to find all symbolic links, >and then examine the link to see if it points to the file in question. This >can be tough, since some links are quite circuitous and not at all obvious. If you really want to, from a csh executing with root permissions enter the following command: SunOS# find / -type l -exec file {} \; | egrep > find.out where is any hard link to the file in question. This will bog your machine significantly, so use at your own risk. Upon completion, find.out will contain a list of symbolic links to the file. > Easiest way: remove the file in question. Wait for the phone to ring. Well, I suppose this would work too, unless the file in question belongs to your boss :-). -- Jay Windley - CIS Dept. - Kansas State University NET: jwindley@matt.ksu.ksu.edu VOICE: (913) 532-5968 FAX: (913) 532-6722 USnail: 323 Seaton Hall, Kansas State Univ., Manhattan, KS 66506 Obligatory quote: "" -- /dev/null