Shell 命令行解释器
接收用户命令、翻译给 OS 执行的程序。 是用户跟 内核 沟通的桥梁。
常见 shell
| Shell | 平台 |
|---|---|
| bash | Linux 默认 |
| zsh | macOS 默认,Linux 可选 |
| fish | 用户友好,Linux/Mac 可选 |
| PowerShell | Windows 现代 shell |
| cmd.exe | Windows 老 shell |
跟 terminal 的区别
| Terminal | Shell | |
|---|---|---|
| 是什么 | 显示文字的窗口程序 | 解析命令的程序 |
| 例 | iTerm, Windows Terminal | bash, zsh |
Terminal 是”屏幕”,shell 是”翻译”。你打字到 terminal,terminal 把字给 shell,shell 调用 OS。
安全场景
shell 命令历史(~/.bash_history)是事后取证的金矿 —— 攻击者干了啥经常留下痕迹。