I mentioned previously
which -a is what you want to use to find what command you’re about to run.
I was wrong.
I found accidentally, probably while reading something on stackoverflow, that
type -a is a better-in-every-way replacement for
which -a. Compare:
Not only does
type -a give me all the same information, it also tells me
about aliases and functions. Consider what happens for functions which do
not have corresponding executables in the PATH:
It tells me it’s a function and it shows me its definition. This has decreased, subtantially, the amount of grepping my dotfiles trying to remember how certain functions work.