The CHSH command is used to modify your logon shell.

Source: Internet
Author: User

 

1. I want to know which shells have been installed on my machine?
You can view the following two methods:

First:

[Rocrocket @ wupengchong ~] $ CHSH-l
/Bin/sh
/Bin/bash
/Sbin/nologin
/Bin/zsh

Second:

[Rocrocket @ wupengchong ~] $ CAT/etc/shells
/Bin/sh
/Bin/bash
/Sbin/nologin
/Bin/zsh

In fact, CHSH-L is also used to view this file.

2. I want to know which shell I am currently using?

[Rocrocket @ wupengchong ~] $ Echo $ Shell
/Bin/bash

Note that shell must be capitalized. As you can see, the current shell I use is/bin/bash.

3. After zsh is executed, I can check whether the current shell type is still/bin/bash?

Please note that although we have executed zsh, the so-called "Current Shell" is a big environment concept for a logged-on user. However, we only started a zsh interpreter program to execute zsh without changing the general environment. If you want to change the "current shell", you still need to use CHSH.

4. I want to change my shell to zsh!

[Rocrocket @ wupengchong ~] $ CHSH-S/bin/zsh
Changing shell for rocrocket.
Password:
Shell changed.
[Rocrocket @ wupengchong ~] $

Use CHSH and the option-s to modify the logon shell!

You will find that the output is still/bin/bash after executing echo $ shell, because you need to restart your shell to fully invest in zsh.

5. Where has CHSH-s been modified?

Tell you the secret. CHSH-s actually modifies the line corresponding to your user name in the/etc/passwd file. Now let's check:

[Rocrocket @ wupengchong ~] $ CAT/etc/passwd | grep ^ rocrocket
Rocrocket: X: 500: 500: rocrocket, China:/rocrocket/PSB/Home:/bin/zsh

Look! You can find that the last part of the output content has become/bin/zsh! Next time you restart, Linux will read this command to start your shell!

Now, I want to resume normal operation. I will be familiar with/bin/bash when I modify the shell!

[Rocrocket @ wupengchong ~] $ CHSH-S/bin/bash
Changing shell for rocrocket.
Password:
Shell changed.

Over ~

To use ksh, just type: Ksh.

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.