Ubutun 安装 zsh 和 oh-my-zsh
安装 zsh#
Z shell(Zsh)是一款可用作交互式登录的shell及脚本编写的命令解释器。Zsh对Bourne shell做出了大量改进,同时加入了Bash、ksh及tcsh的某些功能。
# 查看有哪些 shell
cat /etc/shells
# 安装
sudo apt install zsh
# 将 zsh 设置为默认 shell
chsh -s /bin/zsh
# 检查
echo $SHELL
# 返回 /bin/zsh 即表示成功;若没成功,重启终端试试看
安装 oh my zsh#
Oh My Zsh 是基于 Zsh 命令行的一个扩展工具集,提供了丰富的扩展功能,如:主题配置,插件机制,内置的便捷操作等,,可以给我们一种全新的命令行使用体验
# 1. 通过 curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 2. 通过 wget
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 3. 通过 git
cd ~
git clone https://github.com/ohmyzsh/ohmyzsh ohmyzsh
cd ./tools
sh install.sh
配置#
vim ~/.zshrc
# 更换主题,默认主题安装目录`ohmyzsh/themes`
ZSH_THEME='random'
# 注: 每次登陆随机一种主题,喜欢可以直接修改为对应主题
# 启动错误命令自动更正
ENABLE_CORRECTION="true"
# 在命令执行的过程中,使用小红点进行提示
COMPLETION_WAITING_DOTS="true"
# 启用已安装的插件,默认插件安装目录 `ohmyzsh/plugins`
plugins=(
colorize
colored-man-pages
extract
git
screen
web-search
z
zsh-autosuggestions
zsh-syntax-highlighting
git-open
)
主题效果列表
Themes · ohmyzsh/ohmyzsh Wiki (github.com)
自带插件
- 跟踪最常访问的目录 -
z
- 网页搜索插件 -
web-search plugin
- 解压压缩包插件 -
extract
安装插件#
# 手工安装插件
cd ~/.oh-my-zsh/plugins
# 1. 自动补全
git clone https://github.com/zsh-users/zsh-autosuggestions zsh-autosuggestions
# 2. 代码高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting zsh-syntax-highlighting
# 3. 快速打开 GitHub 仓库
git clone https://github.com/paulirish/git-open git-open
# 更新 zsh 配置文件
source ~/.zshrc
安装字体#
# 克隆字体
git clone https://github.com/powerline/fonts --depth=1
# 安装字体
cd fonts
./install.sh
# 清理环境
cd ..
rm -rf fonts
作者:augustine0654
出处:https://www.cnblogs.com/augustine0654/p/17131772.html
版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)