安装 Zshh2
Zsh 是一个功能强大的 Shell,提供了丰富的增强特性和更佳的用户体验。首先,更新包列表并安装 Zsh:
sudo apt updatesudo apt install zsh
# 验证安装版本zsh --version设置 Zsh 为默认 Shellh3
chsh -s $(which zsh)验证当前 Shell:
echo $SHELL # 应显示 /usr/bin/zsh安装 Oh My Zshh2
通过官方脚本安装(任选一种方式):
# 使用 curlsh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 或使用 wgetsh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"插件推荐h3
效率增强h4
| 插件名称 | 功能描述 | 安装命令 |
|---|---|---|
zsh-autosuggestions | 历史命令自动提示 | git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM}/plugins/zsh-autosuggestions |
zsh-syntax-highlighting | 实时语法高亮 | git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting |
fzf | 模糊搜索文件/命令 | sudo apt install fzf && git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install |
Git 工具h4
| 插件名称 | 功能描述 | 备注 |
|---|---|---|
git | 内置 Git 快捷命令 | 如 gst = git status |
git-extras | 扩展 Git 命令 | 需额外安装:sudo apt install git-extras |
gitfast | 快速 Git 补全 | 适合大型仓库 |
开发工具h4
| 插件名称 | 支持工具 |
|---|---|
docker | Docker 命令补全 |
npm | npm 包管理补全 |
python | Python 相关工具补全 |
系统管理h4
| 插件名称 | 功能描述 |
|---|---|
systemd | systemctl 命令补全 |
sudo | 按两次 ESC 快速添加 sudo |
tmux | Tmux 会话管理 |
趣味插件h4
在 .zshrc 的 plugins 列表中添加 emoji 和 cowsay,例如:
plugins=(... emoji cowsay)需先安装 cowsay:
sudo apt install cowsay完整配置示例h3
.zshrc 文件片段:
plugins=( git zsh-autosuggestions zsh-syntax-highlighting fzf docker systemd sudo emoji)补充工具h2
Tmuxh3
apt install tmux -y || yum install tmux -ycurl -SsL https://pan.0197011.xyz/down/s/tmux.sh | bash命令替代h3
apt install btop -y || yum install btop -y