1 直接安装zsh
#sudo apt update
#sudo apt install zsh
显示版本
# zsh --version
zsh 5.8 (x86_64-ubuntu-linux-gnu)
设置ZSH为默认shell
# chsh -s /bin/zsh
修改vps上的hosts
#whereis hosts
hosts: /etc/hosts.allow /etc/hosts.deny /etc/hosts /usr/share/man/man5/hosts.5.gz
# vi /etc/hosts
添加如下内容
127.0.0.1 localhost
# GitHub Start
52.74.223.119 github.com
192.30.253.119 gist.github.com
54.169.195.247 api.github.com
185.199.111.153 assets-cdn.github.com
#151.101.76.133 raw.githubusercontent.com
151.101.108.133 raw.githubusercontent.com
151.101.108.133 user-images.githubusercontent.com
151.101.76.133 gist.githubusercontent.com
151.101.76.133 cloud.githubusercontent.com
151.101.76.133 camo.githubusercontent.com
151.101.76.133 avatars0.githubusercontent.com
151.101.76.133 avatars1.githubusercontent.com
151.101.76.133 avatars2.githubusercontent.com
151.101.76.133 avatars3.githubusercontent.com
151.101.76.133 avatars4.githubusercontent.com
151.101.76.133 avatars5.githubusercontent.com
151.101.76.133 avatars6.githubusercontent.com
151.101.76.133 avatars7.githubusercontent.com
151.101.76.133 avatars8.githubusercontent.com
# GitHub End
安装oh-my-zsh(下面是官网命令)
Method Command
curl sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
wget sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fetch sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
最终因为“墙”的问题,总是出现下面的问题
Failed to connect to raw.githubusercontent.com port 443: Connection refused
安装了openssl,安装git,安装wget,修改了上面的hosts,都无济于事。我就不打算折腾了,直接玩zsh也罢。
不玩不知道,zsh更方便。
2 新建一个zshrc配置文件如下
vi ~/.zshrc
文件内容如下
autoload -U compinit promptinit
compinit
promptini
执行命令 source ~/.zshrc 来生效修改的配置,而不需要重新登录,然后使用命令
# prompt -p
哈哈,显示如下缤纷灿烂的提示符,我选择prompt adam1,每次登录会恢复到原始状态,根据心情,选择一个就好。