chsh command in Linux with examples
chsh command in Linux is used to change the user’s login shell(currently login shell). Shell is an interactive user interface with an operating system and can be considered an outer layer of the operating system. The bash shell is one of the most widely used login shells in Linux. This command allows the user to change the shell from the current shell. It can also give warning if the shell is not present in the /etc/shells file. The superuser can change the login shell for the existing accounts.
chsh [OPTIONS] [LOGIN]
Example 1: To show the list of all shells. You can use echo command along with ‘$SHELL’ to check the current shell
Example 2: To change the current logging shell
- -l: Used to specifies your login shell.
- -u: Prints the list of shells.
- -v: Shows information about version and exits.
- -s: Used to set the shell as your login shell.