目前的centos系统默认的shell还是bash,但是zsh被称为终极shell,国外有个程序员开发出了一个能够让你快速上手的zsh项目,叫做「oh my zsh」,Github 网址是:https://github.com/robbyrussell/oh-my-zsh 有了这玩意zsh用起来直接就变成神器了。
echo $SHELL
返回的结果是:
/bin/bash
查看bin下是否有zsh包
cat /etc/shells
**********************************************
返回的结果是:
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
PS.默认没有安装zsh
sudo yum install -y zsh
然后在输入cat /etc/shells
查看
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
/bin/zsh
将zsh设置成默认的shell
chsh -s /bin/zsh
设置完以后不会立即生效,需要重启终端方能生效
查看版本
zsh --version
**********************************************
返回的结果是:
zsh 5.0.2 (x86_64-redhat-linux-gnu)
通过 GitHub安装容易出现安装失败的情况,所以我们采用 gitee 镜像仓库来安装
wget https://gitee.com/Devkings/oh_my_zsh_install/raw/master/install.sh -O - | sh
出现以下界面就表示安装成功了
__ __
____ / /_ ____ ___ __ __ ____ _____/ /_
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/ ....is now installed!
Please look over the ~/.zshrc file to select plugins, themes, and options.
p.s. Follow us on https://twitter.com/ohmyzsh
p.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh
执行命令source .zshrc
就可以显示oh-my-zsh的默认主题robbyrussell
~% source .zshrc
➜ ~
可以通过ls .oh-my-zsh/themes
查看当前可用主题,也可以去ohmyzsh 主题页预览效果
➜ ~ ls .oh-my-zsh/themes
3den.zsh-theme cypher.zsh-theme frisk.zsh-theme jonathan.zsh-theme mikeh.zsh-theme re5et.zsh-theme superjarin.zsh-theme
adben.zsh-theme dallas.zsh-theme frontcube.zsh-theme josh.zsh-theme miloshadzic.zsh-theme refined.zsh-theme suvash.zsh-theme
af-magic.zsh-theme darkblood.zsh-theme funky.zsh-theme jreese.zsh-theme minimal.zsh-theme rgm.zsh-theme takashiyoshida.zsh-theme
afowler.zsh-theme daveverwer.zsh-theme fwalch.zsh-theme jtriley.zsh-theme mira.zsh-theme risto.zsh-theme terminalparty.zsh-theme
agnoster.zsh-theme dieter.zsh-theme gallifrey.zsh-theme juanghurtado.zsh-theme mlh.zsh-theme rixius.zsh-theme theunraveler.zsh-theme
alanpeabody.zsh-theme dogenpunk.zsh-theme gallois.zsh-theme junkfood.zsh-theme mortalscumbag.zsh-theme rkj-repos.zsh-theme tjkirch_mod.zsh-theme
amuse.zsh-theme dpoggi.zsh-theme garyblessington.zsh-theme kafeitu.zsh-theme mrtazz.zsh-theme rkj.zsh-theme tjkirch.zsh-theme
apple.zsh-theme dstufft.zsh-theme gentoo.zsh-theme kardan.zsh-theme murilasso.zsh-theme robbyrussell.zsh-theme tonotdo.zsh-theme
arrow.zsh-theme dst.zsh-theme geoffgarside.zsh-theme kennethreitz.zsh-theme muse.zsh-theme sammy.zsh-theme trapd00r.zsh-theme
aussiegeek.zsh-theme duellj.zsh-theme gianu.zsh-theme kiwi.zsh-theme nanotech.zsh-theme simonoff.zsh-theme wedisagree.zsh-theme
avit.zsh-theme eastwood.zsh-theme gnzh.zsh-theme kolo.zsh-theme nebirhos.zsh-theme simple.zsh-theme wezm.zsh-theme
awesomepanda.zsh-theme edvardm.zsh-theme gozilla.zsh-theme kphoen.zsh-theme nicoulaj.zsh-theme skaro.zsh-theme wezm+.zsh-theme
bira.zsh-theme emotty.zsh-theme half-life.zsh-theme lambda.zsh-theme norm.zsh-theme smt.zsh-theme wuffers.zsh-theme
blinks.zsh-theme essembeh.zsh-theme humza.zsh-theme linuxonly.zsh-theme obraun.zsh-theme Soliah.zsh-theme xiong-chiamiov-plus.zsh-theme
bureau.zsh-theme evan.zsh-theme imajes.zsh-theme lukerandall.zsh-theme oldgallois.zsh-theme sonicradish.zsh-theme xiong-chiamiov.zsh-theme
candy-kingdom.zsh-theme fino-time.zsh-theme intheloop.zsh-theme macovsky-ruby.zsh-theme peepcode.zsh-theme sorin.zsh-theme ys.zsh-theme
candy.zsh-theme fino.zsh-theme itchy.zsh-theme macovsky.zsh-theme philips.zsh-theme sporty_256.zsh-theme zhann.zsh-theme
clean.zsh-theme fishy.zsh-theme jaischeema.zsh-theme maran.zsh-theme pmcgee.zsh-theme steeef.zsh-theme
cloud.zsh-theme flazz.zsh-theme jbergantine.zsh-theme mgutz.zsh-theme pygmalion-virtualenv.zsh-theme strug.zsh-theme
crcandy.zsh-theme fletcherm.zsh-theme jispwoso.zsh-theme mh.zsh-theme pygmalion.zsh-theme sunaku.zsh-theme
crunch.zsh-theme fox.zsh-theme jnrowe.zsh-theme michelebologna.zsh-theme random.zsh-theme sunrise.zsh-theme
我比较喜欢的是agnoster
这个主题
修改文件.zshrc
ZSH_THEME="agnoster"
更新配置文件
source .zshrc
当然也可以参考推荐:Slant - What’s the best theme for Oh My Zsh?
最火的莫过于Powerlevel10 k 了,但是 zsh
必须是 5.1
以上版本
手动安装
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
国内用户可以使用 gitee上的官方镜像加速下载.
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Powerlevel10k 配置
编辑 .zshrc
文件, 文件路径 ~/.zshrc
vim ~/.zshrc
# 修改
ZSH_THEME="powerlevel10k/powerlevel10k"
Powerlevel10k 需要进行一些样式的设置,执行source .zshrc
更新配置后,首次会进入样式设置引导,后期也可以通过命令
p10k configure
去修改设置。