Indiana University
University Information Technology Services
  
What are archived documents?

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 $SHELL

Shells 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/bash

Changing your shell

  • On computers running Linux, at the Unix prompt, enter: chsh -s newshell

    Replace newshell with 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:

    chsh -l
  • On computers running Solaris, at the Unix prompt, enter: chsh newshell

    Replace newshell with the full pathname of the shell you want to use. To see a list of the available shells, at the Unix prompt, enter:

    chsh
  • On HP-UX machines, at the Unix prompt, enter: chsh username newshell

    Replace username with your username, and newshell with the full pathname of the shell you wish to use.

    For example, if dvader wanted to change to bash, he would enter:

    chsh dvader /usr/local/bin/bash
  • 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  y  and then Enter, you will be prompted to enter the full path of the new preferred shell. For example, to change to bash, enter:

    /usr/local/bin/bash
  • 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 Enter. To change shells, enter the full pathname of the shell you wish to use. For example, to change to bash from csh, at the "New shell:" prompt, enter:

    /usr/local/bin/bash

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:

This is document benf in domain all.
Last modified on June 10, 2008.
Please tell us, did you find the answer to your question?