Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!erikb From: erikb@cs.vu.nl (Erik Baalbergen) Newsgroups: comp.unix.questions Subject: Re: finding the missing links Keywords: ln Message-ID: <2654@erikb.cs.vu.nl> Date: 30 May 89 09:22:12 GMT References: <207@flattop.UUCP> Reply-To: erikb@cs.vu.nl (Erik Baalbergen) Organization: VU Informatica, Amsterdam Lines: 34 In article <207@flattop.UUCP> rcm@flattop.UUCP (Ron McDowell) writes: >At the risk of starting another 'RTFM' war, I'd like the answer to a simple >question: > >$ echo "hello world" > $HOME/xxx ; ln xxx /tmp/yyy ; ln xxx /usr/tmp/zzz > >I do a 'ls -l /tmp' and see that yyy has 3 links. How can I find the other >two files? Find out /tmp/yyy's inode number, , by typing 'ls -i /tmp/yyy'. Then find all files with this particular as inode number: find / -inum -print This command will print at least the three file names you mentioned. If multiple file systems are mounted, there is a chance that more file names are printed since the inode number is unique only within a single file system. You can apply further heuristics, like find / -inum -links 3 -user -print or even find / -inum -exec cmp '{}' /tmp/yyy ';' -print See the 'find' manual page for details. 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 " primary expression. If you have a 'stat' command available, you can check the device numbers by hand. Erik Baalbergen -- Erik H. Baalbergen Vrije Universiteit / Dept. of Maths. & Comp. Sc. De Boelelaan 1081 1081 HV Amsterdam / The Netherlands tel. +31 20 548 8080