更好用的终端

安装Oh-my-zsh

小娱乐家 发表于February 19, 2020

Linux/Unix提供了很多种Shell,但大多数Linux系统默认使用Bash

安装Zsh

Macos

Macos系统已经自带了Zsh,不需要手动安装

Ubuntu

sudo apt-get install zsh
chsh -s /bin/zsh

Redhat

sudo yum install zsh
chsh -s /bin/zsh

其它

curl:

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
chsh -s /bin/zsh

wget:

sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
chsh -s /bin/zsh

确定默认Shell已经更改

echo $SHELL

如果没有更改,则需要重启一下终端

安装oh-my-zsh

git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

查看可用的主题

ls ~/.oh-my-zsh/themes

修改主题,编辑 ~/.zshrc

ZSH_THEME="candy"

安装插件

自动补全插件

cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-autosuggestions
vi ~/.zshrc