How to make zsh as the default shell on Ubuntu


Making ZSH shell the Default Shell on Ubuntu
Making ZSH shell the Default Shell on Ubuntu

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

Ignore point 1 and 2 if you already have zsh installed,

  1. Open Terminal and first to apt update (need to add sudo if not root user)
    # apt update
    Get:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease [265 kB]
    Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [114 kB]
    Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [108 kB]
    Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [114 kB]
    Get:5 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages [1234 kB]
    Get:6 http://ports.ubuntu.com/ubuntu-ports focal/multiverse arm64 Packages [139 kB]
    Get:7 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 Packages [11.1 MB]
    Get:8 http://ports.ubuntu.com/ubuntu-ports focal/restricted arm64 Packages [1317 B]                                
    Get:9 http://ports.ubuntu.com/ubuntu-ports focal-updates/restricted arm64 Packages [3529 B]                        
    Get:10 http://ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 Packages [1253 kB]                            
    Get:11 http://ports.ubuntu.com/ubuntu-ports focal-updates/multiverse arm64 Packages [9055 B]                       
    Get:12 http://ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 Packages [1045 kB]                        
    Get:13 http://ports.ubuntu.com/ubuntu-ports focal-backports/main arm64 Packages [50.8 kB]                          
    Get:14 http://ports.ubuntu.com/ubuntu-ports focal-backports/universe arm64 Packages [21.6 kB]                      
    Get:15 http://ports.ubuntu.com/ubuntu-ports focal-security/universe arm64 Packages [766 kB]                        
    Get:16 http://ports.ubuntu.com/ubuntu-ports focal-security/restricted arm64 Packages [3291 B]                      
    Get:17 http://ports.ubuntu.com/ubuntu-ports focal-security/main arm64 Packages [879 kB]                            
    Get:18 http://ports.ubuntu.com/ubuntu-ports 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.
  2. 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:1 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 libcap2 arm64 1:2.32-1 [15.5 kB]
    Get:2 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 libgdbm6 arm64 1.18.1-5 [26.4 kB]
    Get:3 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 zsh-common all 5.8-3ubuntu1 [3744 kB]
    Get:4 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 zsh arm64 5.8-3ubuntu1 [653 kB]
    Fetched 4438 kB in 4s (1266 kB/s)
    debconf: delaying package configuration, since apt-utils is not installed
    Selecting previously unselected package libcap2:arm64.
    (Reading database ... 4120 files and directories currently installed.)
    Preparing to unpack .../libcap2_1%3a2.32-1_arm64.deb ...
    Unpacking libcap2:arm64 (1:2.32-1) ...
    Selecting previously unselected package libgdbm6:arm64.
    Preparing to unpack .../libgdbm6_1.18.1-5_arm64.deb ...
    Unpacking libgdbm6:arm64 (1.18.1-5) ...
    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) ...
    Setting up libgdbm6:arm64 (1.18.1-5) ...
    Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
  3. Now use 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
  4. Close the terminal and launch again to take in effect.
  5. You would see now the default shell is zsh.



Recent Posts:




Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.