If you're using Bash or zsh, use this:
type -a lshw
This will show whether the target is a builtin, a function, an alias or an external executable. If the latter, it will show each place it appears in your PATH
.
bash$ type -a lshw
lshw is /usr/bin/lshw
bash$ type -a ls
ls is aliased to `ls --color=auto'
ls is /bin/ls
bash$ zsh
zsh% type -a which
which is a shell builtin
which is /usr/bin/which
In Bash, for functions type -a
will also display the function definition. You can use declare -f functionname
to do the same thing (you have to use that for zsh, since type -a
doesn't).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…