zsh 安装及初始配置
Zsh安装及配置
Zsh is a shell designed for interactive use, although it is also a powerful scripting language.
Zsh 安装
# 查看当前使用的shell
echo $SHELL
# /bin/bash 默认是bash
# 查看有哪些shells
cat /etc/shells
# 安装 zsh
sudo apt-get install zsh -y
# 查看zsh版本
zsh --version
# 安装后zsh 后cat /etc/shells 才有/bin/zsh /usr/bin/zsh
# 切换成zsh
chsh -s $(which zsh)
# 或者这条命令
chsh -s /usr/bin/zsh
ohmyzsh 安装
Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.
# 安装 ohmyzsh
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
# 使用预置配置文件
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
Zsh插件
# 高亮 zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# 自动提示 zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# ~/.zshrc
# 启用插件
plugins=(
# 内置插件,直接填写启用即可(选择)
# git
git
# 根据过往目录切换记录快速跳转
z
# 按两下esc键,用sudo权限
sudo
# 记录历史输入的zsh命令,自动提示,快速使用
zsh-autosuggestions
# zsh 命令高亮
zsh-syntax-highlighting
)
# 每次修改了这个`.zshrc`配置文件,需要重载一下,才能生效。
source ~/.zshrc
# 也可以封装成一个简写命令 alias,这样每次输入rl就可以重载
alias rl='source ~/.zshrc'
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!