I came up with this chain:
find . -type l -ls | egrep -o -- '-> .+$' | sort | uniq -c
It lists all symbolic links, greps for whatever comes after
->, sorts it and groups it.
It is a first step, but by far not perfect. You can run
/ to get a big list, but if the symbolic link is to a relative target, the command will group them together even if they are not the same.
/home/shi/bin/list.sh -> ./show.sh
/home/shi/sbin/all.sh -> ./show.sh
show.sh might be different programs - one in
bin and another one in
Another issue are regular file names with
-> in them (not very common, though). The format of
ls cannot distinguish this.
test.sh -> all.sh -> list.sh
A file called
test.sh might link to
all.sh -> list.sh or a file called
test.sh -> all.sh might link to
I hope this helps in your case. For a perfect solution you should use a script (sh, PHP, Perl).