Linux 系统安装 Oh my posh 终端美化工具

Linux 环境下安装 Oh my posh 终端美化工具参照如下流程。这里准备了一个脚本 linux-oh-my-posh.sh , 下载终端运行,重启终端既可以使用上,脚本内容说明如下:

# 1. 下载 Oh my posh 64位版本,并导入到 /usr/local/bin/oh-my-posh 路径下
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh

# -> github 下载速度慢,可以参照网络上 github 加速方法,更换下载源
sudo wget https://github.91chi.fun/https://github.com//JanDeDobbeleer/oh-my-posh/releases/download/v7.61.0/posh-linux-amd64 -O /usr/local/bin/oh-my-posh

# 2. 为 oh-my-posh 添加运行权限
sudo chmod +x /usr/local/bin/oh-my-posh

# 3. 下载主题文件并解压,解压后添加读写权限,并清除原始压缩包
mkdir ~/.poshthemes
# -> github 下载速度慢,可以参照网络上 github 加速方法,更换下载源
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

# 4. 更改主题
vi ~/.bashrc 
-> 添加如下代码
eval "$(oh-my-posh --init --shell bash --config ~/.poshthemes/*.json)"

# 5. 安装NF字体,再次打开即可以使用。

说明1 :访问 Nerd Fonts 的下载界面,从中任意选择一个心仪的字体包,下载压缩包后解压,再安装进系统即可。Oh my posh 官方推荐 Meslo LGM NF。

posted @ 2022-04-12 14:57  Oddpage  阅读(1619)  评论(6编辑  收藏  举报