Linux内置命令

内置命令在bash/builtins目录中

shell命令分为内置命令和外部命令.

查看一个命令是内置命令还是外部命令:

1
2
3
type -a [command]

提示"[command] is a shell builtin"就表示是内置命令,否则就是外部命令。

查看所有内置命令:

1
2
help
enable -a

查看内置命令的帮助:

1
help [command]

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
type
enable
help

alias
bg
bind
break
builtin
caller
cd
command
compgen
complete
compopt
continue
declare
dirs
disown

echo
echo "_${VAR}_" // 查看变量前后是否有空格.

eval
exec
exit
export
false
fc
fg
getopts
hash
history
jobs
kill
let
local
logout
mapfile
popd
printf
pushd
pwd
read
readarray
readonly
return
set
shift
shopt
source
suspend
test
times
trap
true
typeset
ulimit
umask
unalias
unset
wait