Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to change my shell from the default bash shell to zsh on my Amazon EC2 instances. How do I go about doing it? Thanks!

share|improve this question
up vote 147 down vote accepted

Try using the chsh command.


chsh -s /bin/zsh

You can confirm the location of zsh by running whereis zsh, or alternatively simply run

chsh -s $(which zsh)

If you want to change the shell for a user account other than the one you're logged into, you'll need to run it as root, so to change john's shell, do:

sudo chsh -s $(which zsh) john

Note that you'll need to log out and log back in for the change to go into effect. If you're using Gnome or some other window manager, you'll need to completely log out of that session as well—simply closing and opening your terminal is insufficient.

share|improve this answer
I did try that, but with the root user!! My AMI Image has ubuntu rather than root. Had to switch to ubuntu user to change the shell! Thanks for the hint :) – Shripad Krishna Jan 11 '11 at 11:45
@Paddy if you are root you can change it for another user by running chsh -s /bin/zsh username. – John T Jan 11 '11 at 11:47
Awesome :) Much easier. Thanks for that info too. – Shripad Krishna Jan 11 '11 at 11:48
@We are the World: You need to add /usr/local/bin/zsh as a new line to /etc/shells – Nate Parsons Jun 4 '13 at 17:54
I use a lightly different version sudo chsh -s $(which zsh) $(whoami) – user45032 Apr 30 '15 at 19:37

Open /etc/passwd:

sudo vi /etc/passwd

Find the line with your username:

username:x:1634231:100:Your Name:/home/username:/bin/bash

and replace bash with zsh:

username:x:1634231:100:Your Name:/home/username:/bin/zsh

Log out and log in back for the changes to take effect.

share|improve this answer
It's better to use chsh, but if you're really going to edit /etc/passwd by hand, at least use the vipw command. – Valmiky Arquissandas Aug 14 '14 at 2:58
I don't have chsh on my machine. Also, for some weird reason my /etc/passwd file is regularly being overwritten by the default one. Do you know why this could be happening? – Georgii Oleinikov Aug 14 '14 at 16:44

On Ubuntu, inside GNOME terminal, making changes via chsh won't have the expected effect...

To get over this problem, do this:

  • Right click in terminal
  • Profiles -> Profile Preferences
  • Under "Title and Command" tab, tick "Run a custom command instead of my shell" and provide the path to zsh executable.
  • Restart Terminal.


P.S. Don't have 10 reputation to post images, so all texty instructions. :)

share|improve this answer
You have the rep you need now. :P – pradyunsg Mar 21 at 8:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.