lln - a routine to list all links to a file

kdw1 at sphinx.UUCP kdw1 at sphinx.UUCP
Mon Jan 5 06:34:51 AEST 1987


(I'm directing followups to net.sources.bugs, which I gather is what 
corresponds to net.sources.d under the new naming scheme...)

In net.sources, in reference to the recently posted lln program (which
lists all files linked to a particular file), amos at instable.UUCP (Amos
Shapir) writes:

>What's wrong with:
>
>set `ls -id file`
>find / -inum $1 -print
>
>It's much more portable than the given program, can limit the search
>to any dir instead of /, and is probably faster on most machines.
>The moral is: before writing your own utilities [...]

I have a few comments in support of the author and poster of lln.
I am using System V on an AT&T 3B5.

1. Our man page for find does not list -inum as an option.  I tried it
   anyway, and was surprised to find that it works as I expect it's
   supposed to.  But it seems a bit harsh to blame the author of lln
   for not knowing about what is (for some SysV users, at least) an
   undocumented feature.

2. Lln may be non-portable, but assuming that the options of Unix
   utilities act the same way on different flavors of Unix is too.
   Witness the differences between SysV and BSD greps and awk, to name
   just a couple.

3. On my system, lln is 9 times as fast as the find -inum suggestion.

4. The find -inum suggestion doesn't work.  I-nodes are only unique
   within a file-system.  The find technique, if rooted at / as
   suggested, will find all files with the same i-node.  This is not
   the same as finding all links to a file, which is what lln does.
   When I tried the code above on a file which I knew to have two
   links (and which lln properly reports), find listed the two files,
   plus three totallly different files from two other file systems!

I've already found lln to be quite useful; thanks to the author!

		keith-- 
Keith Waclena               BITNET:       xrtkdw1 at uchimvs1.bitnet
University of Chicago         UUCP: ...ihnp4!gargoyle!sphinx!kdw1
Graduate Library School



More information about the Comp.sources.unix mailing list