type:类型


1.命令作用:

    type命令用来显示指定命令的类型,判断给出的命令是内部命令还是外部命令。


2.使用方式:

    type command


3.参数说明:

    -t:输出“file”、“alias”或者“builtin”,分别表示给定的指令为“外部指令”、“命令别名”或者“内部指令”;


    -p:如果给出的指令为外部指令,则显示其绝对路径;


    -a:在环境变量“PATH”指定的路径中,显示给定指令的信息,包括命令别名;


4.范例:

    

[cgy@localhost ~]$ type ls

ls is aliased to `ls --color=auto'


[cgy@localhost ~]$ type cd

cd is a shell builtin


[cgy@localhost ~]$ type type

type is a shell builtin


[cgy@localhost ~]$ type pwd

pwd is a shell builtin


[cgy@localhost ~]$ type date

date is /bin/date


[cgy@localhost ~]$ type which

which is aliased to `alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'