ubuntu下 oh-my-zsh 安装及配置

施华奥
2023-12-01

oh-my-zsh git地址

https://github.com/robbyrussell/oh-my-zsh

step1 安装zsh (已经安装可省略)

官方解释

Zsh should be installed (v4.3.9 or more recent). If not pre-installed (zsh –version to confirm), check the following instruction here: Installing ZSH

检查zsh版本是否大于等于v4.3.9

  • 检查是否安装zsh $ cat /etc/shells
  • 查看版本 $ zsh –version

安装zsh

sudo apt-get install zsh

step2 安装oh-my-zsh

一键安装(二选一)

curl方式
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

wget方式
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

普通安装

摘录自https://github.com/robbyrussell/oh-my-zsh

Manual Installation

1. Clone the repository:
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

2. Optionally, backup your existing ~/.zshrc file:
cp ~/.zshrc ~/.zshrc.orig

3. Create a new zsh configuration file
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

4. Change your default shell
chsh -s /bin/zsh

5. Initialize your new zsh configuration
Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration.

step3 安装powerline (以便于使用一些好看的主题,例如agnoster)

安装powerline

sudo apt-get install powerline

安装powerline fonts

# clone
git clone https://github.com/powerline/fonts.git
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts

step4 更改putty等远程终端登录工具,支持Powerline字体,避免乱码

cd ~/.local/share/fonts目录下
选择一个自己喜欢的字体,在window下安装即可
## 安利下DejaVu字体,程序员最爱。
DejaVu Sans Mono Bold for Powerline.ttf
DejaVu Sans Mono Bold Oblique for Powerline.ttf
DejaVu Sans Mono for Powerline.ttf
DejaVu Sans Mono Oblique for Powerline.ttf 

大家这可以直接来这里下载DejaVu for Powerline.zip

 类似资料: