How to Change Your Shell

Under some version of Unix, users can use the `chsh` or `passwd -e` commands to edit the shell configured for their account in the passwd file. Under other Unix variants, only the root user can use these commands.

Your shell is defined in the last field of the password file.  If you have “root” privileges, you can edit the password file to change your shell.  If you change your shell to an invalid shell, you will not be able to login again to repair your error.  In this example password file entry, the current shell is /bin/bash:

will:x:869:869:Will Spencer:/home/will:/bin/bash

In some versions of Unix, it is possible for a Unix user to change his shell by setting an environment variable called “SHELL” in their .profile.

Under all versions of Unix, you can add an entry in your .profile or .login startup script to start a new shell for you.

A list of valid shells for your system can be found in the /etc/shells file.

Rate this article:

Last updated .

Follow Will.Spencer on