其它教程 · 2024年8月28日

type命令 – 查看命令类型

type命令来自英文单词“类型”,其功能是用于查看命令类型,如需区分某个命令是Shell内部指令还是外部命令,则可以使用type命令进行查看。

语法格式:type [参数] 命令名称

常用类型:

builtin 内部指令
file 文件
function 函数
keyword 关键字
alias 别名
unfound 没有找到

参考示例

查看某指定别名命令的类型信息:

[root@linuxcool ~]# type ls
ls is aliased to `ls --color=auto'

查看某指定Shell内部指令的类型信息:

[root@linuxcool ~]# type cd
cd is a shell builtin

查看某指定关键字的类型信息:

[root@linuxcool ~]# type if
if is a shell keyword