主頁 > 知識庫 > Linux中的內(nèi)置命令和外部命令詳解

Linux中的內(nèi)置命令和外部命令詳解

熱門標(biāo)簽:鹽城客服外呼系統(tǒng)軟件 貴陽語音電銷機(jī)器人招商 北京市地圖標(biāo)注 鄭州營銷外呼系統(tǒng)運(yùn)營商 焦作人工智能電話機(jī)器人軟件 2020電銷機(jī)器人排行 淘寶系統(tǒng)退貨外呼項(xiàng)目考試答案 廳外呼梯系統(tǒng)布線 百度地圖標(biāo)注陰影動態(tài)

Linux的命令分為內(nèi)部命令和外部命令:

1.內(nèi)部命令在系統(tǒng)啟動時就調(diào)入內(nèi)存,是常駐內(nèi)存的,所以執(zhí)行效率高。
2.外部命令是系統(tǒng)的軟件功能,用戶需要時才從硬盤中讀入內(nèi)存。

type可以用來判斷一個命令是否為內(nèi)置命令

復(fù)制代碼
代碼如下:

type: usage: type [-afptP] name [name ...]


復(fù)制代碼
代碼如下:

[root@linuxeye ~]# type type
type is a shell builtin
[root@linuxeye ~]# type -p type
[root@linuxeye ~]# type -t type
builtin
[root@linuxeye ~]# type type
type is a shell builtin
[root@linuxeye ~]# type -t type
builtin
[root@linuxeye ~]# type pwd
pwd is a shell builtin
[root@linuxeye ~]# type whiptail
whiptail is /usr/bin/whiptail
[root@linuxeye ~]# type -t whiptail
file

enable既可以查看內(nèi)部命令,同時也可以判斷是否為內(nèi)部命令

復(fù)制代碼
代碼如下:

[root@linuxeye ~]# enable -a #查看內(nèi)部命令
[root@linuxeye ~]# enable whiptail #非內(nèi)部命令
-bash: enable: whiptail: not a shell builtin
[root@linuxeye ~]# enable pwd #是內(nèi)部命令

內(nèi)部命令用戶輸入時系統(tǒng)調(diào)用的速率快,不是內(nèi)置命令,系統(tǒng)將會讀取環(huán)境變量文件.bash_profile、/etc/profile去找PATH路徑。

然后在提一下命令的調(diào)用,有些歷史命令使用過后,會存在在hash表中,當(dāng)你再次輸入該命令它的調(diào)用會是這樣一個過程。

hash——>內(nèi)置命令——>PATH   命令的調(diào)用其實(shí)應(yīng)該是這樣一個過程。

復(fù)制代碼
代碼如下:

[root@linuxeye ~]# type pwd
pwd is a shell builtin
[root@linuxeye ~]# type cat
cat is /usr/bin/cat
[root@linuxeye ~]# pwd
/root
[root@linuxeye ~]# ls linuxeye*
linuxeye.pem linuxeye.txt
[root@linuxeye ~]# cat linuxeye.txt
linuxeye
[root@linuxeye ~]# hash -l #顯示hash表
builtin hash -p /usr/bin/cat cat
builtin hash -p /usr/bin/ls ls
[root@linuxeye ~]# type cat
cat is hashed (/usr/bin/cat)
[root@linuxeye ~]# hash -r #清除hash表
[root@linuxeye ~]# type cat
cat is /usr/bin/cat

從上面操作可以看出。hash表不存放系統(tǒng)內(nèi)置命令。

標(biāo)簽:大興安嶺 大理 六安 青島 樂山 遼寧 周口 大慶

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Linux中的內(nèi)置命令和外部命令詳解》,本文關(guān)鍵詞  Linux,中的,內(nèi)置,命令,和,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Linux中的內(nèi)置命令和外部命令詳解》相關(guān)的同類信息!
  • 本頁收集關(guān)于Linux中的內(nèi)置命令和外部命令詳解的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章