[lug] Tools to navigate Unix links backwards?

Jeffrey Haemer jeffrey.haemer at gmail.com
Fri Jul 23 09:52:03 MDT 2010


"readlink -f" may help.  It tells you where a file really is if it's a
symlink.  For any subtree, you could do a find and then pipe it to "readlink
-f".

"Hard" links are harder to think about, because Linux and Unix files really
have no names.  If I do this

$ echo hello, world > foo
$ ln foo bar


Then "foo" and "bar" have the same status as names: that is, the underlying
file and inode have nothing in them suggesting that "foo" was the original
name.  A file is just bytes with an inode number.

As Chip points out, you could do a find, pipe to "ls -i" to get the inode
number, then tack on a numeric sort on the inode field, piped to uniq -d to
find dups.  But then what?

Can you provide some use cases?   Examples of what you'd like to do if you
had the tool of your dreams?

On Fri, Jul 23, 2010 at 9:36 AM, Vince Dean <vincedean at frii.com> wrote:

>  I've inherited a system that depends on a complicated directory
> structure with multiple links, both hard and symbolic, to some of the
> files and directories. The fact that there may be many paths to the same
> file (aliases) makes the system hard to understand and maintain. It
> would help if I could easily find all the links to a given file, that
> is, follow the links backwards.
>
> I can imagine a tool which would scan a file system and build an index
> of all the links it finds, so that I could follow the links in both
> directions. It would work something like updatedb and locate.
>
> Does such a tool exist? I can't be the first person to want such a thing.
>
> Thanks,
> Vince
>
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
>



-- 
Jeffrey Haemer <jeffrey.haemer at gmail.com>
720-837-8908 [cell], http://seejeffrun.blogspot.com [blog],
http://www.youtube.com/user/goyishekop [vlog]
פרייהייט? דאס איז יאַנג דינען וואָרט.
*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20100723/154b68b1/attachment.html>


More information about the LUG mailing list