In this question it is recommended repeatedly that to figure out where an executable is located, one should run command -v file
.
I've tried running command -v ls
on a few different systems now and I keep getting alias ls='ls --color=auto'
(always in Bash).
I have three questions:
What am I missing? How is it that
command -v ls
helps?Given that
which
doesn't work properly (according to the comments and answers to the linked question) and assuming that I'm not missing anything in question 1 andcommand -v ls
does help, how can I know whichls
is actually ran?What is a POSIX compliant way of figuring this out? My examples are in Bash, but I'm hoping for a portable solution. I know about
type -P
.