新聞中心
type命令 用來顯示指定命令的類型,判斷給出的指令是內(nèi)部指令還是外部指令,下面為大家分享一下type命令具體使用方法。

在呼和浩特等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供網(wǎng)站建設(shè)、成都做網(wǎng)站 網(wǎng)站設(shè)計(jì)制作按需網(wǎng)站策劃,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),品牌網(wǎng)站建設(shè),成都全網(wǎng)營(yíng)銷,外貿(mào)營(yíng)銷網(wǎng)站建設(shè),呼和浩特網(wǎng)站建設(shè)費(fèi)用合理。
如何使用type命令
type命令是bash內(nèi)置,type語(yǔ)法:
type [-afptP] [name ...]
例如,查看type的類型:
[root@localhost ~]# type type
type is a shell builtin
也可以提供多個(gè)參數(shù):
[root@localhost ~]# type vim sleep head
vim is hashed (/usr/bin/vim)
sleep is /usr/bin/sleep
head is /usr/bin/head
命令的類型
-t選項(xiàng)告訴type打印一個(gè)描述命令類型的單詞,該單詞會(huì)是下面其中之一:
-
alias – 別名
-
builtin – 內(nèi)置命令
-
file – 文件
-
keyword – 關(guān)鍵字
這里有一些例子:
Alias
[root@localhost ~]# type -t ls
alias
# 在Centos系統(tǒng)中,ls別名對(duì)應(yīng)的命令是ls --color=auto
[root@localhost bin]# type ls
ls is aliased to `ls --color=auto'
Builtin
[root@localhost ~]# type -t printf
builtin
printf是shell內(nèi)置的命令
File
[root@localhost ~]# type -t awk
file
awk是可執(zhí)行的文件
Keyword
[root@localhost ~]# type -t while
keyword
while、for、if、else……等等,是Bash中保留的關(guān)鍵字
顯示命令的位置和類型
使用-a命令可以顯示命令的位置和類型:
[root@localhost ~]# type -a ls printf awk while
ls is aliased to `ls --color=auto' ls is /usr/bin/ls printf is a shell builtin printf is /usr/bin/printf awk is /usr/bin/awk while is a shell keyword
這個(gè)實(shí)例執(zhí)行后顯示了ls,printf,awk,while命令的類型和位置。
總結(jié)
type工具用于顯示命令的類型信息。它將展示在命令行上輸入給定的命令將如何解釋。
當(dāng)前標(biāo)題:詳解type命令
文章分享:http://www.5511xx.com/article/djpegoh.html


咨詢
建站咨詢
