Linux chsh command parameters and usage detailed

Source: Internet
Author: User

Use Rights: All users

Command: CHSH

Usage:shell>> CHSH

Description: Change the user shell settings


Shell>> Chsh

changing fihanging shell for User1

Password: [del]

New Shell [/bin/tcsh]: ### [is currently used Shell]


Shell>> chsh-l ### Display/etc/shells archive contents







Recommended reading: Select Shell with chsh command

1 I want to know which shells are installed on my machine?

There are two ways to view:

First type:

[ ~]$ Chsh-l





The second type:

[ ~]$ Cat/etc/shells





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

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

[ ~]$ Echo $SHELL


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

3 after zsh, do I see the current shell type still/bin/bash?

Please note that although we have implemented zsh, the so-called "current shell" is a concept of a large environment, for a logged-on user. And our executive Zsh just started a ZSH interpreter program, and it didn't change the big environment. If you want to change the "current Shell", then you still have to use CHSH.

4 I want to change my shell into zsh!.

[ ~]$ chsh-s/bin/zsh

changing shell for Rocrocket.


Shell changed.

[ ~]$

Use CHSH plus option-S to modify the login shell!

You'll find that you're still outputting/bin/bash when you perform echo $SHELL, because you need to reboot your shell to fully engage in the zsh embrace.

5 chsh-s In the end is changed where?

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

[ ~]$ Cat/etc/passwd|grep ^rocrocket


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

Well, I'm going to get back to work, and I'm going to change the shell/bin/bash I'm familiar with!

[ ~]$ chsh-s/bin/bash

changing shell for Rocrocket.


Shell changed.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.