If you want to change your shell then you can use the chsh command which will change your user login shell. If you are the root user you can change the login shell for any user however if you are a standard user then you can only change your own shell. Note that changes do not take effect until the next time you log in.

Current shell

You can see your current shell by entering:

env

where you'll see a line like the following:

SHELL=/bin/bash

Available shells

To see a list of all available shells, type in:

cat /etc/shells

where you'll see a list of shells similar to this:

/bin/sh
/bin/dash
/bin/bash
/bin/rbash

To change your shell

You can change your shell by simply typing chsh at the prompt. You'll see a dialog as follows:

Changing the login shell for gary
Enter the new value, or press ENTER for the default
Login Shell [/bin/bash]:

If you are root and want to change the shell for another user, you can use the following command:

chsh -s /usr/local/bin/bash username

NB: You don't need to modify /etc/passwd to change the shell that you're using but be aware that this is the file that contains your shell information. For example:

root:x:0:0:root:/root:/bin/bash

Comments

comments powered by Disqus