更新系统并安装必要工具

sudo apt update && sudo apt upgrade -y
sudo apt install zsh git curl wget -y

安装 Oh My Zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

安装 Powerlevel10k 主题

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

配置 Oh My Zsh 使用 Powerlevel10k

编辑 ~/.zshrc

vim ~/.zshrc

注释掉 ZSH_THEME="robbyrussell"

添加 ZSH_THEME="powerlevel10k/powerlevel10k"

安装 Nerd Fonts(解决图标乱码)

# 下载
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/FiraCode.zip
# 解压
unzip FiraCode.zip -d ~/.local/share/fonts/
# 刷新缓存
fc-cache -fv
# 删除
rm FiraCode.zip

安装插件(自选)

Zsh 自动建议(输入历史建议)

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Zsh 语法高亮

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

编辑配置文件

vim  ~/.zshrc

文件-代表删除+代表新增

- plugins=(git)
+ plugins=(
+   git
+   zsh-autosuggestions
+   zsh-syntax-highlighting
+ )

配置完毕后输入
exec zsh
重启终端

持久化配置

which zsh 查看安装位置

2. 永久修改默认 Shell(需要输入密码)

chsh -s $(which zsh)

安装后重启电脑即可

如果想要重新配置可以输入即可

p10k configure
最后修改:2025 年 08 月 26 日
如果觉得我的文章对你有用,请随意赞赏