查看当前shell
echo $SHELL
查看系统shell列表
cat /etc/shells
切换shell到zsh,需要重新启动(服务器即 Ctrl + D)
chsh -s /bin/zsh
安装oh-my-zsh
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
修改主题
vim ~/.zshrc
ZSH_THEME="agnoster"
source ~/.zshrc
安装插件
-
zsh-autosuggestions 自动补全
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions vim ~/.zshrc // 找到plugins plugins=(git zsh-autosuggestions) source ~/.zshrc -
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting vim ~/.zshrc // 写入文件最后一行 # Note the source command must be at the end of .zshrc source "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
问题1:安装oh-my-zsh时遇到Connecting to raw.github.com (raw.github.com)|151.101.228.133|:443... failed
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh --no-check-certificate -O -)"