ubuntu install zsh and oh-my-zsh

 

Mac installation reference: http://www.cnblogs.com/EasonJim/p/6283247.html

The difference between zsh and on-my-zsh: http://www.cnblogs.com/EasonJim/p/7863093.html

Note: zsh is not installed by default under Ubuntu, and zsh is installed by default under Mac.

Note: After installing oh-my-zsh, the environment variable entry will be changed from ./bashrc to ./zshrc. This is something to be careful when configuring environment variables. You can refer to the Mac configuration, basically the same: http://www.cnblogs.com/EasonJim/p/6283190.html

1. Installation:

1. Install zsh

sudo apt-get install zsh

2. Change the default Shell to zsh

chsh -s /bin/zsh

Note: Do not use sudo.

3. Configure the password file to solve the problem of chsh: PAM authentication failure

sudo vim /etc/passwd

Change the first line of /bin/bash to /bin/zsh, this is for the root user.

Change the last line of /bin/bash to /bin/zsh, this should be the login user name + computer name of each computer.

4. Install Git

sudo apt-get install git

5. Install oh-my-zsh

Why install it for quick configuration of zsh.

Official website: http://ohmyz.sh/

Offline version: (link:  https://pan.baidu.com/s/1i5iqYhB  password: v5c2), if you use the offline version, you need to modify it to executable permissions: sudo chmod +x *.sh

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

6. Restart the computer and check the effect

 

7, install autojump automatic jump plug-in

Official website: https://github.com/wting/autojump

installation:

sudo apt-get install autojump

Configuration tutorial: cat /usr/share/doc/autojump/README.Debian

Configuration:

vim .zshrc #Add 
in the last line, note that there is a space after the point 
. /usr/share/autojump/autojump.sh

Effective:

source ~/.zshrc

8. Install the zsh-syntax-highlighting syntax highlighting plugin

Official website: https://github.com/zsh-users/zsh-syntax-highlighting

installation:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc

Effective:

source ~/.zshrc

9. Install the zsh-autosuggestions syntax history plugin

Official website: https://github.com/zsh-users/zsh-autosuggestions

installation:

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
plugins=(zsh-autosuggestions)

Then you will find that the above sentence will not take effect. Popular science here: there are many plug-ins under ~/.oh-my-zsh/plugins, you can load the plug-ins directly by using the command plugins=(ant mvn svn git).

After research, it is found that if you use plugins to execute the plug-in, you must first use the software after the machine has been installed. And this method does not support command execution under Ubuntu, it can only be used under the .zshrc file, and then use source ~/.zshrc to make it effective. This is the place where Ubuntu is relatively awkward.

So the above plugins should be placed in ~/.zshrc, and the specific modifications are as follows:

I came ~ / .zshrc

Add plug-in:

Then add the execution file of zsh in the last line:

source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh

Effective:

source ~/.zshrc

10. Configure the theme

Official theme reference: https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes

sudo vim ~/.zshrc

Find ZSH_THEME="robbyrussell" and modify it to: ZSH_THEME="ys";

Effective:

source ~/.zshrc

 

2. Uninstall:

carried out:

sudo sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/uninstall.sh)"

Change /etc/passwd back to bash:

/Bin/bash on the first line

/Bin/bash on the last line

Guess you like

Origin blog.csdn.net/qq_42293496/article/details/108655051