A shell is an environment that can be used to execute commands, programs, and shell scripts. Linux shells provide an interface to the Linux kernel. To interact with the shell, we use the programs called terminal emulators which include, gnome-terminal, Konsole, and xterm.
There are a variety of shells available to Linux users
- csh, tcsh – These are well-known and widely used derivatives of the Borne shell. They have a similar syntax to C programming language thus favored by programmers as one can use it without learning bash.
- ksh – The popular Korn Shell which is popular among sysadmins and more of similar to bash.
- bash – The Bourne Again Shell is the most popular shell used for Linux and developed by GNU. It also comes installed with Linux distributions. It is designed to be compatible with old scripts while supporting improved features.
- zsh – The Z-shell was designed to be interactive and compatible with older shells whilst providing improved features. It is easy to use and highly customizable.
- Fish – The Friendly Interactive Shell is user-friendly and easier to use than the other shells. It provides the autocomplete suggestion and man pages completion features.
Zsh as discussed above is designed to be interactive and easily incorporate some of the best features in older shells while providing improved features. It is also a strong scripting language just like the other shells.
- Highly customizable options and plugins
- Easy to use
- Filename generation
- Command completion
- Startup files
- Built-in Spelling correction
- Recursive path expansion
This guide will show you to install and configure Zsh and Oh My Zsh framework on Ubuntu|KDE Neon|Kubuntu.
Install Zsh on Kubuntu / KDE Neon /Ubuntu
Update your system packages
### Kubuntu & Ubuntu ### sudo apt update && sudo apt upgrade -y ### KDE Neon ### sudo apt update && sudo pkcon update -y
Once updated, run the following command to install Zsh
sudo apt install -y zsh
You can check its path to confirm successful installation by check-in its version.
$ zsh --version zsh 5.8 (x86_64-ubuntu-linux-gnu)
You can also check its location using the following command.
$ which zsh /usr/bin/zsh
Then change it to your default shell.
sudo chsh -s /usr/bin/zsh
Log out then log in again to use Zsh.
Configure Zsh for the first time
When you start Zsh for the first time you will be required to configure it for easier use. Select ‘1′ option to continue to the main menu.
This page will appear, where it will have 4 options that are recommended to set. You can start with the first option of history configurations by pressing 1.
On the history configurations page, simply press 1, 2, or 3 to change the configurations. Once you make the alterations, the status will be changed from “not yet saved” to “set but not saved”.
Press “0” (zero) to return to the main menu but the file is not saved yet.
Do the same to the other configurations which are completion system, keys, and common shell options while pressing “0” to go back to the main menu. After you are done with all the settings alterations, the main menu shows all options as unsaved changes.
Press “0” again to save all the changes which will exit the main menu and the following page will show.
Then confirm this by checking the default shell.
$ echo $SHELL /bin/zsh
You can also use the neofetch command. If you do not have neofetch installed in your system, use the following command to install it.
sudo apt install neofetch -y
Then run the following command to get an output.
It will show the screen below.
Another Short way to configure
If you prefer to set the configurations in the shortest time possible, you can select option ‘2’ while on the main menu to populate the .zshrc file with default settings.
If you do not like the default settings, You can change the parameters in the .zshrc file.
Oh My Zsh
It is an open-source framework for managing Zsh configuration. It comes bundled with helpful functions, helpers, plugins, and themes that enable you to customize your shell by extending its features to fit your identity.
Install Oh My Zsh on Ubuntu / KDE Neon / Kubuntu
Install missing packages
sudo apt install curl git wget
Then install Oh-My-Zsh using any of the following commands below.
### Using wget ### sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" ### using curl ### $ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Successful installation will show such a page.
Once you install Oh My Zsh, The .zshrc file is renamed to .zshrc-pre-oh-my-zsh. Then any configuration can be done on the new .zshrc file.
Enabling Plugins in Oh My Zsh
Oh My Zsh comes with a lot of plugins available that you can enable on your Zsh. To enable plugins, go to your .zshrc file.
Find the spot to add the plugin(s) you want. You can add them in a new line, space, or TAB. It should not be separated with a comma or it will break. It would look like something as below.
To set themes and enable them, go to your .zshrc file and set it with the name of the theme.
The default theme is Robby Russell. Let’s say I want to set nebirhos as my theme, I will just edit it on the file as shown below.
Save and exit the file, then open a new terminal window to see the difference.
Update Oh My Zsh on Kubuntu / KDE Neon / Ubuntu
To update Oh My Zsh manually just run the following command
$ omz update Updating Oh My Zsh __ __ ____ / /_ ____ ___ __ __ ____ _____/ /_ / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ / /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / \____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ /____/ Oh My Zsh is already at the latest version. To keep up with the latest news and updates, follow us on Twitter: @ohmyzsh Want to get involved in the community? Join our Discord: Discord server Get your Oh My Zsh swag at: Planet Argon Shop
You can also set the update to be automatic using the following command.
zstyle ':omz:update' mode auto
Or you can set it to remind you to update using the following code.
zstyle ':omz:update' mode reminder
From this guide, we have installed and configured Zsh and Oh My Zsh on Ubuntu|KDE Neon|Kubuntu system. We have also learned how to enable plugins and set themes on the Oh My Zsh framework ins simple steps.