如果您使用的是Bash或zsh,请使用以下命令:
type -a lshw
这将显示目标是内置,函数,别名还是外部可执行文件。如果是后者,它将显示在中显示的每个位置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
在Bash中,对于函数,type -a
还将显示函数定义。您可以declare -f functionname
用来做同样的事情(您必须对zsh使用它,因为type -a
没有这样做)。