zsh 配置实例

环境:centos6.9 (虚拟机)

1,查看系统当前shell

[root@centos6 ~]# echo $SHELL
/bin/bash
[root@centos6 ~]# 

2,查看当前环境有哪些shell

[root@centos6 ~]# cat /etc/shells 
/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
[root@centos6 ~]#

2.1,我们发现没有zsh,,那么安装zsh

[root@centos6 ~]# yum install zsh

3,切换到zsh

[root@centos6 ~]# chsh -s /bin/zsh
Changing shell for root.
Shell changed.
[root@centos6 ~]#

3.1,再次查看当前shell

[root@centos6 ~]# echo $SHELL
/bin/zsh
  • 如果发现还是bash 没关系,,随便打一个常用命令,如果他能自动补全其实就已经切换成功了,重启下就行了

4,下载oh-my-zsh

[root@centos6 ~]# wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh

5,安装和配置
5.1,先安装git

[root@centos6 ~]# yum install git

5.2,修改刚才下载的脚本的权限并安装

[root@centos6 ~]# ls -l
总用量 4
-rw-r--r--. 1 root root 4019 1月  26 06:16 install.sh
[root@centos6 ~]# chmod +x install.sh 
[root@centos6 ~]# ./install.sh 
Cloning Oh My Zsh...
Initialized empty Git repository in /root/.oh-my-zsh/.git/
remote: Counting objects: 849, done.
remote: Compressing objects: 100% (713/713), done.
remote: Total 849 (delta 16), reused 777 (delta 10), pack-reused 0
Receiving objects: 100% (849/849), 578.66 KiB | 199 KiB/s, done.
Resolving deltas: 100% (16/16), done.
Looking for an existing zsh config...
Using the Oh My Zsh template file and adding it to ~/.zshrc
Time to change your default shell to zsh!
Changing shell for root.
Shell not changed.
         __                                     __   
  ____  / /_     ____ ___  __  __   ____  _____/ /_  
 / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ 
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / 
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  
                        /____/                       ....is now installed!


Please look over the ~/.zshrc file to select plugins, themes, and options.

p.s. Follow us at https://twitter.com/ohmyzsh.

p.p.s. Get stickers and t-shirts at https://shop.planetargon.com.

➜  ~ 

6,zsh的主题文件存放在这里

/root/.oh-my-zsh/themes/

7,修改主题的话只需要编辑这个文件

vim /root/.zshrc 

ZSH_THEME="theme_file_name"

8,应用生效

source /root/.zshrc

你可能感兴趣的:(zsh 配置实例)