"Choose shell with Chsh"-linux command five-minute series 12

Source: Internet
Author: User

The CHSH command is used to modify your login shell.

1 I want to know which shells are installed on my machine?
There are two ways to view:

The first type:

[Email protected] ~]$ chsh-l
/bin/sh
/bin/bash
/sbin/nologin
/bin/zsh

The second type:

[Email protected] ~]$ Cat/etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/zsh

In fact Chsh-l is also to view this file.

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

[Email protected] ~]$ echo $SHELL
/bin/bash

Note that the shell must be capitalized. As you can see, the shell I'm currently using is/bin/bash

3 after executing the zsh, I check that the current shell type is still/bin/bash?

Note that although we performed the zsh, the so-called "current Shell" is a concept of a large environment that is intended for a logged-on user. And we execute zsh just started a ZSH interpreter program, and did not change the big environment. If you want to change the "current Shell", then you still need to use CHSH.

4 I want to change my shell to zsh!.

[Email protected] ~]$ chsh-s/bin/zsh
changing shell for Rocrocket.
Password:
Shell changed.
[Email protected] ~]$

You can modify the login shell by using the CHSH plus option-s!

You will find that you are still outputting/bin/bash after performing the Echo $SHELL, because you need to restart your shell to fully engage in the zsh embrace.

5 Chsh-s exactly where was the change?

Let me tell you the secret. Chsh-s actually modifies the line that corresponds to your user name in the/etc/passwd file. Now let me look at the following:

[Email protected] ~]$ Cat/etc/passwd|grep ^rocrocket
Rocrocket:x:500:500:rocrocket,china:/rocrocket/psb/home:/bin/zsh

See! You can see that the final part of the output has become/bin/zsh! The next time you reboot, Linux will read this command to start your shell!

OK, I want to return to normal work, the shell changes will be my familiar/bin/bash!

[Email protected] ~]$ chsh-s/bin/bash
changing shell for Rocrocket.
Password:
Shell changed.

over~

Chsh-l may not be available under Ubuntu

Operation Result:


Man out of the Chsh

Have-l option not known why not available

"Choose shell with Chsh"-linux command five-minute series 12

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.