Chsh command

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to navigation Jump to search

The chsh command is used to change your login shell. If a shell is not given on the command line, chsh prompts for one.

chsh command syntax

The syntax is as follows:

chsh -s /path/to/new/shell
chsh -s /bin/ksh userName

How do I print the list of available shell in my system?

The -l option displays the list of shells listed in /etc/shells file:

chsh -l

Sample outputs:

/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh
/bin/zsh

How do I change my current login shell from bash to ksh?

Simply type the following command[1]:

chsh -s /bin/ksh

References