ubuntu 安装 oh-my-posh
前言
根据 Windows Terminal 中 powerline 的教程发现 oh-my-posh 还可以安装到 ubuntu 系统下,于是尝试了一下
安装
Windows Terminal 中 ubuntu 安装 oh-my-posh 教程:https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup
oh-my-posh 官网:https://ohmyposh.dev/docs/
- linux 安装教程:https://ohmyposh.dev/docs/linux
- 字体安装教程:https://ohmyposh.dev/docs/fonts
安装 oh-my-posh
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
chmod +x /usr/local/bin/oh-my-posh
配置
mkdir ~/.poshthemes
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip
unzip ~/.poshthemes/themes.zip -d ~/.poshthemes
chmod u+rw ~/.poshthemes/*.json
rm ~/.poshthemes/themes.zip
如果您使用的是 Ubuntu 18.04 或 16.04,则需要先安装正确版本的 golang:
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
自定义您的 Ubuntu 提示
查看所有主题
for file in ~/.poshthemes/*.omp.json; do echo "$file\n"; oh-my-posh --config $file --shell universal; echo "\n"; done;
~/.bashrc
使用nano ~/.bashrc
或您选择的文本编辑器打开文件。这是一个 bash 脚本,每次 bash 启动时运行。添加以下内容(将主题更改为您喜欢的主题):
eval "$(oh-my-posh --init --shell bash --config ~/.poshthemes/jandedobbeleer.omp.json)"
如果出现乱码注意安装字体 官方推荐字体 Cascadia Mono PL 使用上会有问题 ,推荐 Meslo LGM NF
字体安装
官方推荐Meslo LGM NF:https://ohmyposh.dev/docs/fonts
下载地址:https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Meslo.zip
安装方法:https://www.cnblogs.com/yuqianwen/p/3715835.html
解压
unzip Meslo.zip -d Meslo
cd Meslo
安装
sudo mkdir /usr/share/fonts/ttf
sudo cp *.ttf /usr/share/fonts/ttf
cd /usr/share/fonts/ttf
sudo chmod 744 *
sudo mkfontscale
sudo mkfontdir
sudo fc-cache -f -v
在 vscode 中字体设置
"terminal.integrated.fontFamily": "MesloLGM NF"
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通