Monday, March 19, 2012

Changing login shell on a Linux machine

How can you change your default login shell on a Linux machine?

Whenever you get your first account on a Linux machine, your account will use Bourne Again Shell as its default login shell. But using bash is not a requirement, you can choose any shell to be your login shell. The chsh utility is used to change your default login shell.

'chsh' allows you to change your default login shell. It prompts you for the full pathname of the new shell, which is then used as your shell for subsequent logins.

For example, I changed my default login shell from Bash to a C shell:

$ chsh ...change the login shell.

Changing shell for smith

Password: ...must verify you are who you say.

New shell [/bin/bash]: /bin/tcsh ...enter full pathname.

$ ^D ...terminate login shell.

login: glass ...log back in again.

Password: ...its private

% _ ...this time I'm in a C shell.


List of full pathnames of the shells as needed for chsh linux utility.

Shell
Full pathname
Bash /bin/bash (or /bin/sh)
Korn /bin/ksh
C /bin/tcsh (or /bin/csh)

There is also another way to find out the full pathname of your login shell, which is to type the following:

$ echo $SHELL ...display the name of my login shell.

/bin/tcsh ...full pathname of the C shell.

$ _

0 comments:

Post a Comment