全能终端实用工具
Zsh 安装
cat /etc/shells
先看下你的 CentOS 支持哪些 shell:cat /etc/shells,正常结果应该是这样的:
/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
/bin/tcsh
/bin/csh
CentOS 安装:
yum install -y zsh
切换shell为zsh:
chsh -s /bin/zsh
reboot //重启生效
echo $SHELL //重启之后看看默认shell是不是zsh
oh-my-zsh源码是放在github上,先确保你的机器上已安装了git:
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
修改主题:
vim ~/.zshrc
ZSH_THEME="agnoster" //随机主题
source ~/.zshrc
增加实用插件:
//自动补全命令
git clone https://gitee.com/phpxxo/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
//语法高亮提示
git clone git://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
//自动跳转目录
git clone http://github.com/joelthelion/autojump.git
编辑配置文件使得插件生效:
vim ~/.zshrc
plugins=(git autojump zsh-autosuggestions zsh-syntax-highlighting)
DISABLE_UPDATE_PROMPT=true
[[ -s /root/.autojump/etc/profile.d/autojump.sh ]] && source /root/.autojump/etc/profile.d/autojump.sh
autoload -U compinit && compinit -u
source ~/.zshrc