How To Install Zsh on Debian 12
In this tutorial, we will show you how to install Zsh on Debian 12. Zsh (Z Shell) is a powerful Unix shell that functions both as an interactive login shell and as a command interpreter for shell scripting. It is an extended Bourne shell with numerous improvements, incorporating features from Bash, ksh, and tcsh to create a feature-rich command-line environment.
Zsh offers programmable command-line completion that assists with typing options and arguments for hundreds of commands out-of-the-box. The shell provides advanced tab completion capabilities that many users consider one of its most compelling features. Extended file globbing allows file specification without requiring external programs like find.
The shell includes improved variable and array handling with non-zero-based numbering, distinguishing it from traditional shells. Command history sharing occurs among all running shells simultaneously. Zsh supports editing multi-line commands in a single buffer, making complex command construction more manageable.
Spelling correction and autofill capabilities work for command names and optionally for arguments. The shell offers themeable prompts with the ability to display information on the right side of the screen that auto-hides when typing long commands. Various compatibility modes allow Zsh to pretend to be a Bourne shell when run as /bin/sh
.
Additional features include loadable modules providing TCP and Unix domain socket controls, an FTP client, and extended math functions. The built-in “where” command shows all locations of target commands in PATH directories rather than just the first one. Named directories enable shortcuts like ~mydir
that behave similarly to ~
and ~user
.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Zsh on a Debian 12 (Bookworm).
Prerequisites
- A server running one of the following operating systems: Debian 12 (Bookworm).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Zsh.
- A user account with sudo privileges to execute administrative commands.
Install Zsh on Debian 12 Bookworm
Step 1. Update Your Debian system.
Before installing any new software, it’s crucial to update your Debian system to ensure compatibility and security. Open your terminal and enter the following commands:
sudo apt update sudo apt upgrade
Step 2. Installing Zsh on Debian 12.
With your system up to date, you can now install Zsh using Debian’s package manager, apt. Run the following command:
sudo apt install zsh
After installation, you can verify that Zsh has been installed correctly by checking its version. This also confirms that Zsh is accessible through your terminal:
zsh --version
If you’re satisfied with Zsh and want to make it your default shell, use the chsh
command. You’ll need to log out and log back in for the changes to take effect:
chsh -s $(which zsh)
Step 3. Customizing the Zsh Environment.
To customize Zsh, edit the .zshrc
file in your home directory. Some common customizations include:
- Enabling Plugins: Add plugins like syntax highlighting, auto-suggestions, etc.
- Setting Themes: Choose from various prompt themes to customize the look and feel.
- Aliases: Create aliases for commonly used commands.
- Environment Variables: Set environment variables such as
$PATH
.
There are also helpful frameworks like Oh My Zsh that make customizing and managing Zsh easier.
Congratulations! You have successfully installed Zsh. Thanks for using this tutorial to install the latest version of the Zsh on Debian 12 Bookworm. For additional help or useful information, we recommend you check the official Zsh website.