Ubuntu26.04默认的shell环境是bash使用,默认的终端工具 是Ptysix,虽然样式上比以往配置好看多了,但是图标美观上还是差点了,我们可以借助开源包来实现更好看的Shell终端。本次是使用Zsh Shell来实现,所以需要安装该环境 。
效果图展示:

一、先确认你的 Shell
先看一下你现在用的是 Bash 还是 Zsh:
echo $SHELL
- 如果输出
/bin/bash:需要先安装 Zsh - 如果已经是
/bin/zsh:直接跳到第二步
二、安装 Zsh + Oh My Zsh(基础环境)
# 安装 Zsh
sudo apt update
sudo apt install -y zsh git
# 设为默认 Shell(重启终端生效)
chsh -s $(which zsh)
# 安装 Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
安装完成后,关闭并重新打开终端,就进入 Zsh 环境了。
三、安装 Powerlevel10k(关键主题)
好看的工具需要借助主题样式 ,所以下载网上人家开源的包达到想要的效果 。
# 克隆仓库到 Oh My Zsh 主题目录
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
编辑你的 ~/.zshrc:
安装完zsh包后,并切换到该Shell环境,会在当前家目录下生成一个文件 。
vim ~/.zshrc
找到 ZSH_THEME= 这一行,改成:
把上面下载的主题包名添加进来,表示使用该主题
ZSH_THEME="powerlevel10k/powerlevel10k"
保存退出,然后生效配置:
source ~/.zshrc
此时会自动进入 Powerlevel10k 的配置向导,如果没有出现执行命令:p10k configure 。
以下是参考上面效果图的设置选择:(自己也可以根据喜好定制)
- Does this look like a diamond? → y
- Does this look like a lock? → y
- Does this look like an upwards arrow? → y
- What digit is the downwards arrow pointing at? → 1
- Do all these icons fit between the crosses? → y
- Prompt Style → 3 Rainbow
- Character Set → 1 Unicode
- Show current time? → n No
- Prompt Separators → 1 Angled
- Prompt Heads → 3 Sharp
- Prompt Tails → 3 Sharp
- Prompt Height → 1 One line
- Prompt Spacing → 1 Compact
- Icons → 2 Many icons
- Prompt Flow → 2 Fluent
- Enable Transient Prompt? → n No
- Instant Prompt Mode → 1 Verbose
- Overwrite ~/.p10k.zsh? → y yes
执行后,直接可以看到效果。
四、安装 Nerd Font(箭头和图标必须)
为了让Zsh更好看,带上有箭头、文件夹、Git 图标,都依赖带特殊符号的 Nerd Font 字体,推荐 MesloLGS NF:
直接下载字体文件 ,并保存~/.local/share/fonts目录下
# 下载字体文件
mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf
# 刷新字体缓存
fc-cache -fv
然后在 Ptyxis 里设置字体为 MesloLGS NF:
通过命令直接设置
# 替换成你的 UUID
UUID=$(dconf read /org/gnome/Ptyxis/default-profile-uuid | tr -d "'")
dconf write /org/gnome/Ptyxis/Profiles/$UUID/font "'MesloLGS NF 12'"
重启 Ptyxis,图标就不会变成方框了。
五、一键应用 MacOS-Like 配色 + 半透明
# 安装 Zenidog 配色文件
mkdir -p ~/.local/share/org.gnome.Ptyxis/palettes
cat > ~/.local/share/org.gnome.Ptyxis/palettes/MacOS-Like.palette << 'EOF'
[Palette]
Name=MyMac-Like
Primary=true
Color0=#1a1a1a
Color1=#ff5f57
Color2=#28ca42
Color3=#ffbd2e
Color4=#007aff
Color5=#bf5af2
Color6=#5ac8fa
Color7=#f5f5f7
Color8=#8a8f98
Color9=#ff6b6b
Color10=#34d399
Color11=#fbbf24
Color12=#3b82f6
Color13=#a855f7
Color14=#22d3ee
Color15=#ffffff
Background=#1a1a1a
Foreground=#f5f5f7
Cursor=#f5f5f7
EOF
# 应用配色和透明度
UUID=$(dconf read /org/gnome/Ptyxis/default-profile-uuid | tr -d "'")
dconf write /org/gnome/Ptyxis/Profiles/$UUID/palette "'MyMac-Like'"
dconf write /org/gnome/Ptyxis/Profiles/$UUID/opacity 0.80
六、最终效果验证
- 关闭所有 Ptyxis 窗口,重新打开
- 输入命令,看是否出现和截图里一样的箭头、路径、Git 状态条
- 运行
ls -lah,看文件图标是否正常显示
常见问题排查
- 图标变成方框:字体没装对,确认 Ptyxis 里设置的是
MesloLGS NF - Powerlevel10k 没生效:检查
~/.zshrc里的ZSH_THEME是否正确,并且执行过source ~/.zshrc - 没有配置向导:
p10k configure可以手动重新配置样式