In the following example “” will be used to change the login shell from “bash” to “KornShell” for user “test”.
1. To find out what shell you are using just type “echo $SHELL”.
# echo $SHELL /bin/bash
2. You can get the list of available shells in the system from /etc/shells file.
# cat /etc/shells /bin/sh /bin/bash /sbin/nologin /bin/dash /bin/tcsh /bin/csh
3. If the required shell is missing, it can be installed using the “yum” command. In our case the ksh (KornShell) is not installed so we are going to install it.
# yum install ksh.x86_64
4. Following is the syntax of chsh command:
# chsh -s /bin/[shell-name] [user-name]
5. It will prompt you to enter the password and changes the default shell for the user. Changing the default shell for user “test”.
# chsh -s /bin/ksh test Changing shell for test. Shell changed.
6. You must log out and log back in to see this change.
# echo $SHELL /bin/ksh