Change my default shell in Linux using chsh

The chsh command (short for “change shell”) allows you to change the default shell for a user in Linux. Here are the steps to change your default shell using chsh:

  1. Open a terminal window
  2. Run the command cat /etc/shells, this will list the available shells on your system, make sure the shell you want to use is listed there.
  3. Run the command chsh and enter your password when prompted. This will open the /etc/passwd file in your default text editor, with the line for your user highlighted.
  4. Find the line that starts with your username and ends with your current shell. For example, it might look something like this:
username:x:1000:1000:Full Name:/home/username:/bin/bash
  1. Change the shell path to the path of the shell you want to use. For example, to change to zsh, you would change the line to:
username:x:1000:1000:Full Name:/home/username:/bin/zsh
  1. Save and exit the editor.
  2. Log out and log back in for the changes to take effect.
  3. To confirm the change, you can run the command echo $SHELL, this will show your current shell.

It’s worth noting that some shells may require additional configuration or setup steps in order to function properly. If you are unsure about how to proceed, it’s best to consult the documentation for the shell you want to use. (https://www.greenbot.com)

Leave a Comment