How do I list commands shadowed by other commands in PATH?

Posted by sds on Super User See other posts from Super User or by sds
Published on 2013-11-07T20:02:11Z Indexed on 2013/11/07 22:01 UTC
Read the original article Hit count: 259

Filed under:
|

How do I list all the commands in my path which are shadowed by other commands?

E.g., if I have /bin/foo, /bin/bar, /usr/local/bar and /usr/bin/foo, I want to see something like

foo in /bin shadows /usr/bin
bar in /bin shadows /usr/local/bin

I guess I can throw together something based on ls and comm, but I would much prefer something out of the box, especially bash-based (it would also be nice if aliases and functions were searched too, but that is not too important).

© Super User or respective owner

Related posts about command-line

Related posts about path