How do I change my default shell?

QuestionsQuestions8 SkillsProUser Account ManagementOct, 18 2025
0107

To change your default shell in Linux, you can use the chsh (change shell) command or the usermod command. Here’s how to do it using both methods:

Method 1: Using chsh

  1. Open Terminal: Access your terminal interface.

  2. Change Shell: Use the following command, replacing /bin/bash with your desired shell (e.g., /bin/zsh):

    chsh -s /bin/bash
  3. Enter Your Password: You may be prompted to enter your password for verification.

  4. Log Out and Log Back In: For the changes to take effect, log out of your session and log back in.

Method 2: Using usermod

  1. Open Terminal: Access your terminal interface.

  2. Change Shell: Use the following command, replacing username with your actual username and /bin/bash with your desired shell:

    sudo usermod -s /bin/bash username
  3. Verify the Change: You can check if the shell has been changed by running:

    grep -w 'username' /etc/passwd

    Look for the line corresponding to your username to confirm the new shell.

  4. Log Out and Log Back In: Again, log out and log back in for the changes to take effect.

Example

If you want to change your shell to Zsh, you would run:

chsh -s /bin/zsh

or

sudo usermod -s /bin/zsh your-username

Note

  • Ensure that the shell you want to switch to is installed on your system. You can check available shells by looking at the /etc/shells file:
    cat /etc/shells

If you have any further questions or need assistance with a specific shell, feel free to ask!

0 Comments

no data
Be the first to share your comment!