Operating System - HP-UX
1753776 Members
7668 Online
108799 Solutions
New Discussion юеВ

How do I find the softlinks to an specific directory?

 

How do I find the softlinks to an specific directory?

I just need to know wich directories are softlinks to my specific directory.
3 REPLIES 3
Steven Schweda
Honored Contributor

Re: How do I find the softlinks to an specific directory?

So far as I know, symbolic links are one-way.
The file being linked to has no info about
who might be pointing to it. "find" can find
symbolic links:

man find

Look for "-type" (and "l").

Sifting through the resulting mess may
require a little work, too, depending on how
many of the things you have.
Jim Walls
Trusted Contributor

Re: How do I find the softlinks to an specific directory?

Try this:

find / -xdev -type l -exec ll {} \; | awk '{printf("%s -> %s\n",$9,$11)}'

... you could filter the output through grep to find something specific. Or you could do summat clever with the awk.



Dennis Handly
Acclaimed Contributor

Re: How do I find the softlinks to an specific directory?

Here is a thread where this was asked before:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1260358

If the symlinks were relative, that would be harder to check.