命令分类
内建命令
内建命令 是 shell 程序的一部分,其中包含的是一些比较简单的命令,解析内部命令时,shell 不需要创建子进程,因此执行速度比外部命令快
- 常见的内建命令:
history,cd,exit……
外部命令
外部命令 是 Linux 系统中的实用程序部分,在系统加载时不随系统一起被加载到内存中,是在 Bash 之外额外安装的,通常放在 /bin,/usr/bin,/sbin,/usr/sbin……
- 常见的外部命令:
ls,vi……
type
type用于区分命令是内建命令,还是外部命令
bash
type exit
exit is a shell builtin
type vim
vim is /usr/bin/xxx
type ls
ls is an alias for ls --color=tty # 说明ls命令是别名,无法根据ls判断命令类型[!hint] 对比帮助命令
help简明扼要,有内建外部命令之分man详细,Linux 的工具书info非常详细
help
[!hint]
zsh中没有内置help,在Bash中内置了
- 用于内建命令
help 命令 - 用于外部命令
命令 --help
bash
help ls
bash: help: 没有与 `ls' 匹配的帮助主题。尝试 `help help' 或 `man -k ls' 或 `info ls'
ls --helpman
man 命令- pgup 向上翻页
- pgdn 向下翻页
q退出
bash
man ls[!hint] 左上角的
LS(*)表示章节数
1标准命令2系统调用3库函数4设备说明5文件格式6游戏和娱乐7杂项8管理员命令9其他【用来存放内核例行程序的文档】
info
- 安装
bash
sudo apt-get update
sudo apt-get install infoinfo 命令
bash
info ls