type命令:
用來顯示指定命令的類型,判斷給出的指令是內部指令還是外部指令。
type查看的Linux中的命令類型:
- alias:別名。
- keyword:關鍵字,Shell保留字。
- function:函數,Shell函數。
- builtin:內建命令,Shell內建命令。
- file:文件,磁盤文件,外部命令。
- unfound:沒有找到。
type命令選項
-t:直接顯示命令類型
-p:如果給出的指令爲外部指令,則顯示其絕對路徑;
-a:顯示命令執行順序
配置舉例:
1、顯示指定的命令類型
[root@localhost ~]# type cd
cd is a shell builtin
[root@localhost ~]# type ls
ls is aliased to `ls --color=auto'
[root@localhost ~]# type mount
mount is /usr/bin/mount
2、直接顯示命令類型
[root@localhost ~]# type -t cd
builtin
[root@localhost ~]# type -t ls
alias
[root@localhost ~]# type -t mount
file
3、顯示命令執行順序
[root@localhost ~]# type -a cd
cd is a shell builtin
cd is /usr/bin/cd
[root@localhost ~]# type -a ls
ls is aliased to `ls --color=auto'
ls is /usr/bin/ls
[root@localhost ~]# type -a mount
mount is /usr/bin/mount