Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!ncar!boulder!stan!dce From: dce@Solbourne.COM (David Elliott) Newsgroups: comp.unix.questions Subject: Re: finding the missing links Keywords: ln Message-ID: <1299@marvin.Solbourne.COM> Date: 31 May 89 00:07:13 GMT References: <207@flattop.UUCP> <2654@erikb.cs.vu.nl> Reply-To: dce@Solbourne.com (David Elliott) Organization: Solbourne Computer Inc., Longmont, Colorado Lines: 27 In article <2654@erikb.cs.vu.nl> erikb@cs.vu.nl (Erik Baalbergen) writes: >>I do a 'ls -l /tmp' and see that yyy has 3 links. How can I find the other >>two files? > find / -inum -links 3 -user -print >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. While it's a nice idea, it may not be necessary. If you have 4.3BSD or a recent SunOS, your find command has the option -xdev, which prevents it from looking at files in other filesystems (hard links can't cross filesystems), so you can say find -xdev -inum -print To find the root of the filesystem, just use df on the file and pipe the output through an awk or sed script to extract the name (watch out for df printing long names, especially NFS filesystems, since it will produce extra lines). -- David Elliott dce@Solbourne.COM ...!{boulder,nbires,sun}!stan!dce