外部命令位於磁盤上,使用時須要加載到內存中,常見命令有 vi 、ls 等。shell
Bash Shell 內置命令是一個命令或函數,從 shell 中調用,它直接在 shell 中執行。 bash shell 直接執行該命令而無需調用其餘程序。運行在內存中,加載速度很快。bash
內置命令列表使用 help 命令查看。less
#使用方法1 [root@promote ~]# help #能夠上下移動鼠標查看幫助 [root@promote ~]# help | less #查看read幫助 [root@promote ~]# help | grep read #使用方法2 查看簡潔幫助列表 [root@promote ~]# compgen -b [root@promote ~]# compgen -b . : [ alias bg bind break builtin caller cd command compgen complete compopt continue declare dirs disown echo enable eval exec exit export false fc fg getopts hash help history jobs kill let local logout mapfile popd printf pushd pwd read readarray readonly return set shift shopt source suspend test times trap true type typeset ulimit umask unalias unset wait [root@promote ~]#
具體內置命令查看方法以下。函數
#舉例說明,未列舉所有 [root@promote ~]# help cd [root@promote ~]# help : [root@promote ~]# help true true: 真 返回一個成功結果。 退出狀態: 老是成功 [root@promote ~]#
經過 type 或 command 命令能夠區份內置仍是外部命令。ui
[root@promote ~]# type cd cd 是 shell 內嵌 [root@promote ~]# type -a : . [ : 是 shell 內嵌 . 是 shell 內嵌 [ 是 shell 內嵌 [ 是 /usr/bin/[ [root@promote ~]# command -V ls ls 是 `ls --color=auto' 的別名 [root@promote ~]# command -V cd cd 是 shell 內嵌 [root@promote ~]#