wsl环境oh my zsh配置
最近折腾vs code的Remote-ssh功能,想用一个漂亮的terminal,就折腾了下oh my zsh,记录下方便以后查看。
修改mirror 1 2 3 4 cd /etc/apt/cp /etc/apt/sources.list /etc/apt/sources.list_back
切换163镜像 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 cd /etc/apt/sudo vi change_mirror_to_163.sh Codename=$( (lsb_release -a)|awk '{print $2}' |tail -n 1 ) echo "\ deb http://mirrors.163.com/ubuntu/ $Codename main multiverse restricted universe deb http://mirrors.163.com/ubuntu/ $Codename -backports main multiverse restricted universe deb http://mirrors.163.com/ubuntu/ $Codename -proposed main multiverse restricted universe deb http://mirrors.163.com/ubuntu/ $Codename -security main multiverse restricted universe deb http://mirrors.163.com/ubuntu/ $Codename -updates main multiverse restricted universe deb-src http://mirrors.163.com/ubuntu/ $Codename main multiverse restricted universe deb-src http://mirrors.163.com/ubuntu/ $Codename -backports main multiverse restricted universe deb-src http://mirrors.163.com/ubuntu/ $Codename -proposed main multiverse restricted universe deb-src http://mirrors.163.com/ubuntu/ $Codename -security main multiverse restricted universe deb-src http://mirrors.163.com/ubuntu/ $Codename -updates main multiverse restricted universe " >sources.listsudo sh change_mirror_to_163.sh
切换到aliyun 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 cd /etc/apt/sudo vi change_mirror_to_aliyun.sh Codename=$( (lsb_release -a)|awk '{print $2}' |tail -n 1 ) echo "\ deb http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe deb http://mirrors.aliyun.com/ubuntu/ $Codename -backports main multiverse restricted universe deb http://mirrors.aliyun.com/ubuntu/ $Codename -proposed main multiverse restricted universe deb http://mirrors.aliyun.com/ubuntu/ $Codename -security main multiverse restricted universe deb http://mirrors.aliyun.com/ubuntu/ $Codename -updates main multiverse restricted universe deb-src http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe deb-src http://mirrors.aliyun.com/ubuntu/ $Codename -backports main multiverse restricted universe deb-src http://mirrors.aliyun.com/ubuntu/ $Codename -proposed main multiverse restricted universe deb-src http://mirrors.aliyun.com/ubuntu/ $Codename -security main multiverse restricted universe deb-src http://mirrors.aliyun.com/ubuntu/ $Codename -updates main multiverse restricted universe " >sources.listsudo sh change_mirror_to_aliyun.sh
执行更新
可以看到速度明显的改善
1 sudo apt update && sudo apt upgrade
oh my zsh安装
如果没用安装 zsh,请先安装zsh.
安装zsh
https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 cat /etc/shells zsh --version sudo apt update && sudo apt upgrade sudo apt install zsh chsh -s $(which zsh)
curl安装
https://github.com/robbyrussell/oh-my-zsh#basic-installation
1 sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh) "
配置忽略user@hostname
参考:https://github.com/robbyrussell/oh-my-zsh/issues/2033
1 2 3 4 5 6 7 8 9 10 11 # Context: user@hostname (who am I and where am I) prompt_context() { if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then prompt_segment black default "%(!.%{%F{yellow}%}.)$DEFAULT_USER" fi } # DEFAULT_USER=desired_username # 加载配置文件 source ~/.zshrc
配置主题agnoster
https://github.com/robbyrussell/oh-my-zsh#selecting-a-theme
1 2 3 4 5 6 7 vi ~/.zshrc ZSH_THEME="agnoster" source ~/.zshrc
主题agnoster需要的字体
https://github.com/powerline/fonts
1 sudo apt-get install fonts-powerline
重新开启一个terminal来验证,是否成功切换到zsh
参考资料 WSL——Win10的Linux子系统
ubuntu 修改资源镜像