CentOS Open Zsh Tour

Source: Internet
Author: User
It feels good to use zsh development in the company. Many commands prompt you directly, and I try to tinker with my centos system after returning home. I hope it can be installed. The following records the process:

1. View the current system shell

[[email protected] Desktop] $ echo $ SHELL
/ bin / bash
Okay, bash, you can start to change

2. Check whether the current user has root authority, because many installations use root authority, so configure the current user as root authority;

Modify the / etc / sudoers file, find the following line, and add a line under root as follows:
## Allow root to run any commands anywhere
root ALL = (ALL) ALL
demo ALL = (ALL) ALL
After the modification, you can now log in with the demo account, and then use the command su-to get root permissions to operate.

[[email protected] Desktop] $ su
Password:
[[email protected] Desktop] # ls -l / etc / sudoers
-r--r -----. 1 root root 4071 Jan 23 04:35 / etc / sudoers
[[email protected] Desktop] # chmod ugo + w / etc / sudoers
[[email protected] Desktop] # ls -l / etc / sudoers
-rw-rw--w-. 1 root root 4071 Jan 23 04:35 / etc / sudoers
[[email protected] Desktop] # vi / etc / sudoers
############# Change and / etc / sudoers ###################### using the vi command
[[email protected] Desktop] # chmod ugo-w / etc / sudoers
3. Check if there is a zsh package under the centos bin

[[email protected] Desktop] $ cat / etc / shells
/ bin / sh
/ bin / bash
/ sbin / nologin
/ bin / dash
/ bin / tcsh
/ bin / csh
4. Install the zsh package

[[email protected] Desktop] $ sudo yum install zsh
[sudo] password for demo:
############# Enter Y to confirm ######################
[[email protected] Desktop] $ cat / etc / shells
/ bin / sh
/ bin / bash
/ sbin / nologin
/ bin / dash
/ bin / tcsh
/ bin / csh
/ bin / zsh
So far the preparation work is done

5. Use the command chsh -s / bin / zsh to change to SHELL

[[email protected] Desktop] $ echo $ SHELL
/ bin / bash
[[email protected] Desktop] $ chsh -s / bin / zsh
Changing shell for demo.
Password:
Shell changed.
[[email protected] Desktop] $ echo $ SHELL
/ bin / bash
What does this mean that the shell has been changed? Why is it still bash? Is bullying me poor in English? ? Ok, I found the answer online. Just restart it, then restart it

[[email protected] Desktop] $ reboot
6. Install oh-my-zsh after reboot

[[email protected]] ~ / Desktop% echo $ SHELL
/ bin / zsh
After restarting, I found that the shell environment is zsh, and I have succeeded. Hey, wait, why is it so rubbing? Well, go online and search for ways. Nani wants to install

Oh my zsh

When I look at the name, I always have the feeling of being a foreign dan teng.

Install the git environment first;

[[email protected]] ~ / Desktop% sudo yum install git
[sudo] password for demo:
Install oh my zsh

[[email protected]] ~ / Desktop% wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O-| sh

########################## If you look at the picture below, you are successful ############## ########
\ 033 [0; 34mLooking for an existing zsh config ... \ 033 [0m
\ 033 [0; 34mUsing the Oh My Zsh template file and adding it to ~ / .zshrc \ 033 [0m
\ 033 [0; 34mCopying your current PATH and adding it to the end of ~ / .zshrc for you. \ 033 [0m
\ 033 [0; 32m __ __ \ 033 [0m
\ 033 [0; 32m ____ / / _ ____ ___ __ __ ____ _____ / / _ \ 033 [0m
\ 033 [0; 32m / __ \ / __ \ / __ `__ \ / / / / / _ / / ___ / __ \ \ 033 [0m
\ 033 [0; 32m / / _ / / / / / / / / / / / / _ / / / / _ (__) / / / \ 033 [0m
\ 033 [0; 32m \ ____ / _ / / _ / / _ / / _ / / _ / \ __, / / ___ / ____ / _ / / _ / \ 033 [0m
\ 033 [0; 32m / ____ / .... is now installed! \ 033 [0m
Close the current terminal and reopen it to see the refreshing interface of oh my zsh

? Desktop
7. Configure oh my zsh

The configuration of zsh is mainly concentrated in the user's current directory. Zshrc, use vim or other editor you like to open. Zshrc, you will find such a line at the bottom:

# Customize to your needs ...

? Desktop vim /home/demo/.zshrc
You can define your own environment variables and aliases here. Of course, oh my zsh has automatically read the current environment variables and set them during installation. You can continue to add other environment variables.

(1) Configure aliases:

The alias method of the configuration command is: alias ll = ‘ls -l’

I'm a rookie, I didn't get this, let's honestly hit the command

(2) Configure the plug-in

This can be, after all, I ca n’t remember the command. It ’s still very comfortable to have a hint, which greatly deepens the interest in learning.

The oh my zsh project provides a complete plug-in system. The related files are in the ~ / .oh-my-zsh / plugins directory. More than 100 types are provided by default. You can use it according to your actual learning and working environment. The function of this plug-in is as long as you open the zsh file in the relevant directory and look at it. Plugins are also configured in .zshrc, find the plugins keyword, you can load your own plug-ins, the system loads git by default, you can append content after the following, as follows:

plugins = (git textmate ruby autojump osx mvn gradle)
Postscript: During the whole process, I focused on the article http://www.2cto.com/os/201504/387213.html. At the beginning, I found that the old was rejected according to that method, so I did it step by step. So record it! ! ! !



Centos starts zsh journey
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.