Installation of the zsh body
Firstchsh -l, look at the current bash situation, as follows:
[[email protected] ~]# chsh -l
/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
/bin/tcsh
/bin/csh
/usr/bin/tmux
[[email protected] ~]#
If it is CentOS, useyum install -y zshto install ZSH, zsh and then installedoh my zsh, using the Wget method to install
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
Re-usewhich zshview installed zsh in/usr/bin/zsh, this time usechsh -s /usr/bin/zsh, appearedShell changed.so switch to the Zsh interface, need to logout exit the connection re-enter.
Reconnecting will find that the Bash interface has changed, and the path has become a small icon. The theme of the interface can be changed, for example, I personally preferaf-magicthis template, and then/root/.zshrcchange the inside, save theZSH_THEME="robbyrussell"ZSH_THEME="af-magic"file, and once again exit the connection re-entry can see the template changes.
AutoJump Plug-in installation
autojumpAfter this plugin is installed, zsh will automatically record the directory you have visited, through the directoryj + 目录名can be directly jump, and the directory name support fuzzy matching and auto-completion, such as you have accesshadoop-1.0.0to the directory, inputj hadocan jump correctly.j –scan look at your history path library, the installation method is as follows:
git clone git://github.com/joelthelion/autojump.git
Then execute in theautojumpdirectory./install.sh, and the screen will appear as follows:
Copy the above[[ -s /root/.autojump/etc/profile.d/autojump.sh ]] && source /root/.autojump/etc/profile.d/autojump.sh autoload -U compinit && compinit -uto/root/.zshrcthe file, it is best to copy thesource $ZSH/oh-my-zsh.shsentence above, after savingsource ~/.zshrc.
Zsh-syntax-highlighting Plug-in installation
The main effect of this plugin after installation is command highlighting, if it is the wrong command, the color is red, the correct command is green, the installation method is as follows:
cd .oh-my-zsh / plugins
yum install -y git #If git is already installed, do not execute it
git clone git: //github.com/zsh-users/zsh-syntax-highlighting.git
source /root/.oh-my-zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh is added to the end of .zshrc
source ~ / .zshrc
Results are immediate.
End
At this point, your current zsh should have several features:
1, a variety of completion: path completion, command completion, command parameter completion, plug-in content completion and so on. Trigger completion you only need to press one or twotabkeys, the completion of the whole item can use thectrl+n/p/f/b上下左右toggle. For example, you want to kill the Java process, only need to inputkill java + tab键, if there is only one Java process, ZSH will automatically replace the PID of the process, if there are more than one will appear for you to choose.ssh + 空格 + 两个tab键, ZSH will list all the visited hosts and usernames for completion;
2, even if you do not installautojump, as long as the inputd, you will be listed in this reply to the directory, enter the preceding sequence number, you can jump directly;
3, can ignore the CD command, enter..or...and the current directory name can jump;
Of course, in addition to the above points, Zsh also has a lot of rich plug-ins can be used, which need to continue to explore the ...
Resources
Https://github.com/robbyrussell/oh-my-zsh
http://macshuo.com/?p=676
Install zsh in CentOS 7 to raise the shell's high-force lattice