Linux – How to list symbolic link chains

linuxshellsymbolic-link

Given this example:

mkdir a
ln -s a b
ln -s b c
ln -s c d

If I execute:

ls -l d

It will show:

d -> c

Is there a way for ls or any other linux command to show d -> c -> b -> a instead?

Best Answer

Just use namei:

$ namei d
f: d
 l d -> c
   l c -> b
     l b -> a
       d a