which
which php7.2
which php7.2 mysql vim
whereis
whereis php7.2
type
type 用来显示给定命令的类型,并判断该命令是内部指令还是外部指令
语法
type [选项] 参数
可选选项
-
-t输出命令的类型 -
-p如果给定的命令是外部指令,则显示该命令的绝对路径 -
-f不搜索 shell 函数 -
-adisplay all locations containing an executable named NAME; includes aliases, builtins, and functions, if and only if the-poption is not also used -
-Pforce a PATH search for each NAME, even if it is an alias, builtin, or function, and returns the name of the disk file that would be executed ```
使用 -t 选项输出的类型
- alias:别名。
- keyword:关键字,Shell保留字。
- function:函数,Shell函数。
- builtin:内建命令,Shell内建命令。
- file:文件,磁盘文件,外部命令。
- unfound:没有找到。
使用示例
type php7.2
type -p php7.2
type -p php7.2 mysql vim