type

发布时间 2023-12-12 11:49:31作者: 惠恒博
基本概述

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

语法格式

type [参数] 命令名称

常用类型

builtin:内部指令

file:文件

function:函数

keyword:关键字

alias:别名

unfound:没有找到

参考示例

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

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

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

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

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

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