How to find list of available shells by command-line?

To list available valid login shells for use at time, type following command:

cat /etc/shells

Example:

pandya@pandya-desktop:~$ cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/bin/ksh93

For information about shell visit wikipedia.


You can also use chsh -l This will print the list of shells.

Example :-

[anurag@focused ~]$ chsh -l
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin

On at least OpenBSD and NetBSD:

$ getent shells

On (Ubuntu) Linux and many other Unices (including BSDs):

$ grep '^[^#]' /etc/shells

On Solaris, the file /etc/shells may not exist. The list of valid shells is contained in the shells(4) manual. On my vanilla Solaris 11.3 system, this lists the following shells:

/bin/bash         /usr/bin/bash     /bin/pfbash   /usr/bin/pfbash
/bin/csh          /usr/bin/csh      /bin/pfcsh    /usr/bin/pfcsh
/bin/jsh          /usr/bin/jsh      /sbin/jsh     /usr/sbin/jsh
/bin/ksh          /usr/bin/ksh      /bin/pfksh    /usr/bin/pfksh
/bin/ksh93        /usr/bin/ksh93    /bin/pfksh93  /usr/bin/pfksh93
/bin/sh           /usr/bin/sh       /bin/pfsh     /usr/bin/pfsh
/bin/tcsh         /usr/bin/tcsh     /bin/pftcsh   /usr/bin/pftcsh
/sbin/sh          /usr/xpg4/bin/sh  /sbin/pfsh    /usr/xp4/bin/pfsh
/bin/zsh          /usr/bin/zsh      /bin/pfzsh    /usr/bin/pfzsh
/usr/sfw/bin/zsh

It's worth noting that on my installation, neither /usr/sfw/bin/zsh nor /usr/xp4/bin/pfsh exists...

A shorter list of valid Solaris shells (duplicates of each shell removed):

/bin/bash       /bin/ksh        /bin/pfcsh      /bin/pfsh       /bin/sh
/bin/csh        /bin/ksh93      /bin/pfksh      /bin/pftcsh     /bin/tcsh
/bin/jsh        /bin/pfbash     /bin/pfksh93    /bin/pfzsh      /bin/zsh