-
-
Notifications
You must be signed in to change notification settings - Fork 3
Install zsh
To install Zsh on your system, use the appropriate command for your distribution.
For Ubuntu/Debian-based systems:
sudo apt update -y
sudo apt install zsh -yFor Manjaro:
sudo pacman -Sy --noconfirm
sudo pacman -S zsh --noconfirmAfter installation, verify that Zsh is installed:
zsh --versionTo change your default shell to Zsh, run:
chsh -s $(which zsh)Check whether Zsh is set as your default shell:
echo $SHELLIf the output is /bin/bash, you may need to log out and log back in or reboot your system for the changes to take effect.
You can automate all the above steps with the following script:
#!/bin/bash
# Detect OS
if [[ -f /etc/os-release ]]; then
source /etc/os-release
else
echo "Could not determine OS. Exiting."
exit 1
fi
if [[ "$ID" == "manjaro" ]]; then
echo "Installing Zsh on Manjaro..."
# Update package database
sudo pacman -Sy --noconfirm
# Install Zsh
sudo pacman -S zsh --noconfirm
elif [[ "$ID" == "ubuntu" || "$ID_LIKE" == *"debian"* ]]; then
echo "Installing Zsh on Ubuntu..."
# Update package database
sudo apt update -y
# Install Zsh
sudo apt install zsh -y
else
echo "Unsupported OS. Exiting."
exit 1
fi
# Verify Zsh installation
zsh --version
# Set Zsh as the default shell
chsh -s $(which zsh)
# Verify the default shell change
echo "Your current shell is: $SHELL"
# Prompt user to log out or restart if needed
echo "If the output above is still /bin/bash, please log out or reboot."
echo "When you open Zsh for the first time, you may see a configuration menu."
echo "Follow the prompts to configure your shell."
echo "To verify again, run: echo \$SHELL"
When you start Zsh for the first time, you may see the following prompt:
This is the Z Shell configuration function for new users,
zsh-newuser-install.
You are seeing this message because you have no Zsh startup files
(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory ~).
This function can help you with a few settings that should make your use of the shell easier.
You can:
(q) Quit and do nothing. The function will be run again next time.
(0) Exit, creating the file ~/.zshrc containing just a comment.
That will prevent this function from running again.
(1) Continue to the main menu.
(2) Populate your ~/.zshrc with the configuration recommended
by the system administrator and exit (you will need to edit
the file by hand, if so desired).Choose your preferred option, and Zsh will start.
Run the following command to ensure Zsh is set as your default shell:
echo $SHELLThe expected output should be:
/usr/bin/zshFor a detailed guide on installing and configuring Zsh with Oh-My-Zsh, visit Installing-Oh-My-Zsh.