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
:
- Open a terminal window
- 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. - 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. - 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
- 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
- Save and exit the editor.
- Log out and log back in for the changes to take effect.
- 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)