How to make ZSH as the default shell on Ubuntu

Let's see how we can make the Zsh shell the default interactive shell for Ubuntu Linux Operating System,

Ignore step 1 and 2 if you already have Zsh installed,

  • Step 1: Open Terminal and first to apt update (need to add sudo if not root user)

    # apt update
    Get:1 focal InRelease [265 kB]
    Get:2 focal-updates InRelease [114 kB]
    Get:3 focal-backports InRelease [108 kB]
    Get:4 focal-security InRelease [114 kB]
    Get:17 focal-security/main arm64 Packages [879 kB]                            
    Get:18 focal-security/multiverse arm64 Packages [3242 B]                      
    Fetched 17.1 MB in 11s (1593 kB/s)                                                                                 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    1 package can be upgraded. Run 'apt list --upgradable' to see it.
  • Step2 : Now lets install zsh using command - apt install zsh

    # apt install zsh
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following additional packages will be installed:
      libcap2 libgdbm6 zsh-common
    Suggested packages:
      gdbm-l10n zsh-doc
    The following NEW packages will be installed:
      libcap2 libgdbm6 zsh zsh-common
    0 upgraded, 4 newly installed, 0 to remove and 1 not upgraded.
    Need to get 4438 kB of archives.
    After this operation, 17.9 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Get:3 focal/main arm64 zsh-common all 5.8-3ubuntu1 [3744 kB]
    Get:4 focal/main arm64 zsh arm64 5.8-3ubuntu1 [653 kB]
    Fetched 4438 kB in 4s (1266 kB/s)
    Selecting previously unselected package zsh-common.
    Preparing to unpack .../zsh-common_5.8-3ubuntu1_all.deb ...
    Unpacking zsh-common (5.8-3ubuntu1) ...
    Selecting previously unselected package zsh.
    Preparing to unpack .../zsh_5.8-3ubuntu1_arm64.deb ...
    Unpacking zsh (5.8-3ubuntu1) ...
    Setting up zsh-common (5.8-3ubuntu1) ...
    Setting up libcap2:arm64 (1:2.32-1) ...
    Setting up zsh (5.8-3ubuntu1) ...
  • Step 3: Now use the command and you will be prompted to add the path of the shell you want to use as your Login Shell, type the path of Zsh.

    # chsh
    Changing the login shell for root
    Enter the new value, or press ENTER for the default
    	Login Shell [/bin/bash]: /usr/bin/zsh
  • Step 4: Close the terminal and launch again to take effect

You would see now the default shell is zsh.

Making ZSH shell the Default Shell on Ubuntu

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap