linuxcommand-lineutilitysymlink-traversal

"tracing" version of readlink(1)


I would like a version of "readlink -f" that provides a trace of every individual symlink resolution it performs. Something like:

$ linktrace /usr/lib64/sendmail
/usr/lib64 -> lib
/usr/lib/sendmail -> ../sbin/sendmail
/usr/sbin/sendmail
$ 

I know I have used this utility in the past, on linux, and also remember at the time thinking "the name of this tool is completely unintuitive and I will forget it". Well, that day has arrived.


Solution

  • NOBODY WINS. The correct answer is "namei".