Shell 选择与美化
对比 bash / zsh / fish,补充 2025 年常用插件、主题、美化方案,并介绍跨平台一致性配置技巧。
bash
- 多数 Linux 发行版默认 shell,兼容性最好。
- 通过 ble.sh 提供自动补全、语法高亮。
- 配置文件:
~/.bash_profile
(登录)、~/.bashrc
(交互)。 - 可使用
bash-it
或starship
统一提示样式。
zsh
- macOS 默认 shell(Catalina 及以上)。
- 高度可定制,适合个人化配置。
- 推荐框架:
- 常用插件:
zsh-autosuggestions
、zsh-syntax-highlighting
、zsh-completions
。 - 推荐主题:
powerlevel10k
、pure
、spaceship
。
fish
- 语法友好、开箱即用自动补全、提示历史命令。
- 官方主页:https://fishshell.com
- 插件管理器:
- 常用插件:
theme-bobthefish
、fzf
集成、bass
(兼容 bash 脚本)。
跨 shell 美化:starship
- https://starship.rs/
- 支持所有主流 shell,显示 Git 状态、Node 版本、Docker、Kubernetes 上下文。
brew install starship
# 或 curl 安装
sh -c "$(curl -fsSL https://starship.rs/install.sh)"
sh
配置示例:
# ~/.config/fish/config.fish
starship init fish | source
# ~/.zshrc
eval "$(starship init zsh)"
sh
跨平台一致化配置
终端工具推荐
- macOS:iTerm2、Warp(AI + 命令历史)、WezTerm。
- Windows:Windows Terminal + WSL2 + oh-my-posh。
- Linux:Kitty、Alacritty、Tilix。
提高效率的小贴士
- 结合
fzf
(模糊搜索)和ripgrep
、bat
、fd
等现代 CLI 工具。 - 使用
tmux
管理会话,配合tmux-resurrect
持久化。 - 配置别名/函数:
alias k=kubectl
、gco=git checkout
;使用z/zoxide
快速跳转目录。 - 与 AI 助手(Copilot CLI、Warp AI、Fig)结合,但需注意执行命令前复核。
选择 Shell 时遵循「团队一致 + 个人增益」。共享基础配置(如
starship
+fzf
),个人再叠加偏好插件,既能降低学习成本,又能保持高效率。
↑