统信 UOS 安装 zsh 并使用 oh-my-zsh 美化终端

:::warning

注意:此操作之前请先安装 git。参考我的文章:统信 UOS 基本开发环境搭建之 git

:::

统信 UOS 安装 zsh 并使用 oh-my-zsh 美化终端

安装 zsh

1
sudo apt install zsh

给 root 用户安装 oh-my-zsh

由于我们一般是次之前先设置 root 密码

1
sudo passwd root

接着切换到 root 用户

1
su -

我们可以检测是否切换成功

1
2
root@terwer:/home/terwer/app# whoami
root

然后给 root 安装 oh-my-zsh

1
2
3
4
5
6
git clone https://gitee.com/mirrors/oh-my-zsh.git ~/.oh-my-zsh \
&& cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc \
&& git clone https://gitee.com/playerfs/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
&& git clone https://gitee.com/playerfs/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \
&& sed -i 's/^plugins=(/plugins=(zsh-autosuggestions zsh-syntax-highlighting /' ~/.zshrc \
&& chsh -s /bin/zsh

普通用户安装 oh-my-zsh

安装之前,切换到普通用户

1
su - terwer

然后,给普通用户安装 on-my-zsh

1
2
3
4
5
6
git clone https://gitee.com/mirrors/oh-my-zsh.git ~/.oh-my-zsh \
&& cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc \
&& git clone https://gitee.com/playerfs/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
&& git clone https://gitee.com/playerfs/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \
&& sed -i 's/^plugins=(/plugins=(zsh-autosuggestions zsh-syntax-highlighting /' ~/.zshrc \
&& chsh -s /bin/zsh

重启

修改完成记得重启,重启之后,再打开终端,应该就能用 zsh 了。

1
reboot

效果

image-20220608152050585

image-20220608152149520

作者

Terwer

发布于

2022-06-07

更新于

2022-06-07

许可协议

评论