Linux Ubuntu/Mac 终端美化

效果

terminal 最终效果

依赖

  • zsh
  • On my zsh 美化插件
  • 其它插件:zsh-autosuggestions

步骤

安装 zsh

#【Ubuntu】
# 安装 zsh
sudo apt install zsh

# 查看版本号,检测安装是否成功
zsh --version

# 设置默认shell
chsh -s $(which zsh)

# 注销帐号后执行,查看当前shell是否是zsh
echo $SHELL

#【Mac】
brew install zsh zsh-completions

chsh -s /bin/zsh

# 如果没有 port 命令,需要先安装  https://www.macports.org/install.php
# 安装后需要执行 export PATH=/opt/local/bin:/opt/local/sbin:$PATH
sudo port install zsh zsh-completions

#【CentOS】
sudo yum update && sudo yum -y install zsh
chsh -s /bin/zsh # 或 sudo usermod -s $(which zsh) 用户名
echo $SHELL

安装 On my zsh 插件

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

安装 zsh-autosuggestions 插件

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

编辑配置 vim ~/.zshrc

# 调整主题
# 更多主题 https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robboyrussell"

# 设置启用的插件
plugins=(git history history-substring-search node npm wd web-search last-working-dir zsh-autosuggestions vi-mode)

生效配置

source ~/.zshrc

参考

http://houdunren.gitee.io/note/soft/zsh.html#oh-my-zsh

发布了40 篇原创文章 · 获赞 14 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/xchenhao/article/details/104729378
今日推荐