In Unix, what is chsh, and how do I use it to change my shell?
On this page:
Introduction
You can use the chsh command to change your login
shell. The instructions for using chsh vary
among Unix implementations (see below). In all cases,
changes do not take effect until the next time you log in. Executing
the chsh command will not change the
shell you are currently running.
To find out which shell you're currently using, at the Unix prompt, enter:
echo $SHELLShells on IU systems
Note: On the Libra Cluster at IU, the
chsh command resets the login shell temporarily on the
local node, but is overwritten the next time the user information
files are globally distributed from the cluster management server
node. For information on how to permanently change your login shell on
Libra, see On Libra, how do I change my login shell and password?
The following shells are available on all central Unix systems at IUB:
/bin/sh /bin/csh /bin/ksh /usr/local/bin/tcsh /usr/local/bin/bashChanging your shell
- On computers running Linux, at the Unix prompt, enter:
chsh -s newshell
Replace
chsh -lnewshellwith the full pathname of the shell you want to use. Enter your password when prompted, and the system will change your shell. To see a list of the available shells, at the Unix prompt, enter: - On computers running Solaris, at the Unix prompt, enter:
chsh newshell
Replace
chshnewshellwith the full pathname of the shell you want to use. To see a list of the available shells, at the Unix prompt, enter: - On HP-UX machines, at the Unix prompt, enter:
chsh username newshell
Replace
usernamewith your username, andnewshellwith the full pathname of the shell you wish to use.For example, if
chsh dvader /usr/local/bin/bashdvaderwanted to change tobash, he would enter: - On AIX, to list the available shells, at the Unix
prompt, enter:
chsh
The system will then ask you if you really want to change your shell. If you press
/usr/local/bin/bashyand thenEnter, you will be prompted to enter the full path of the new preferred shell. For example, to change tobash, enter: - On computers running Tru64 Unix, at the Unix prompt, enter:
chsh
You'll then see something similar to the following:
Old shell: /bin/csh New shell:The old shell listed is the one currently running. To leave your shell unchanged, press
/usr/local/bin/bashEnter. To change shells, enter the full pathname of the shell you wish to use. For example, to change tobashfromcsh, at the "New shell:" prompt, enter:
Other updates
Once you've changed your shell, you may wish to update your shell customization files if you have changed them for your old shell. The names of these files will depend on which shell you have chosen.
For more information about what customization files your shell uses, see In Unix, what startup and termination files do the various shells use?
Also see:
- In Unix, where can I get information on differences between the various shells?
- In Unix, what are the two main classes of shells?
- How do I restart my Unix session (re-source my initialization files)?
- Introduction to Unix commands
- In Unix, what is the shell?
Last modified on June 10, 2008.






