Changing default shell in Linux

LinuxBashShellEnvironmentTcsh

Linux Problem Overview


How is it possible to change the default shell? The env command currently says:

SHELL=/bin/tcsh

and I want to change that to Bash.

Linux Solutions


Solution 1 - Linux

Try linux command chsh.

The detailed command is chsh -s /bin/bash. It will prompt you to enter your password. Your default login shell is /bin/bash now. You must log out and log back in to see this change.

The following is quoted from man page:

> The chsh command changes the user login shell. This determines the > name > of the users initial login command. A normal user may only change the > login shell for her own account, the superuser may change the login > shell for any account

This command will change the default login shell permanently.

Note: If your user account is remote such as on Kerberos authentication (e.g. Enterprise RHEL) then you will not be able to use chsh.

Solution 2 - Linux

You can change the passwd file directly for the particular user or use the below command

chsh -s /usr/local/bin/bash username

Then log out and log in

Solution 3 - Linux

You should have a 'skeleton' somewhere in /etc, probably /etc/skeleton, or check the default settings, probably /etc/default or something. Those are scripts that define standard environment variables getting set during a login.

If it is just for your own account: check the (hidden) file ~/.profile and ~/.login. Or generate them, if they don't exist. These are also evaluated by the login process.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmahmoodView Question on Stackoverflow
Solution 1 - LinuxSummer_More_More_TeaView Answer on Stackoverflow
Solution 2 - LinuxDesert IceView Answer on Stackoverflow
Solution 3 - LinuxarkaschaView Answer on Stackoverflow