Written by Amar Panjwani
Technical Writer
Z Shell (zsh) is a popular alternative to the default command line bash shell with improved features like recursive path expansion, automatic spelling correction, and plug-in and theme support.
This guide will walk you through the process of installing and configuring zsh, including how to change themes and enable the time-saving autosuggestions plug-in.
Complete the following steps prior to getting started:
sudo apt install curl wget git
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
You should now see the following prompt asking if you'd like to change your defaut shell to zsh. Type y
to confirm.
Take a look at your new command line and you should notice the difference right away.
If for any reason you need to switch back to the bash shell, use the following command:
Proceed to log out and back into your session for the change to take effect.
Run echo $SHELL
to confirm the output is /bin/bash
By default, the zsh theme is set to robbyrussell
, the name of the founder of Oh My Zsh. However, this is rather plain and there are over 100+ included themes with a wider assortment of colors and styles to choose from.
For example, here are 3 uniquely different themes to choose from:
Follow these steps to change themes to jonathan
:
Press i
to enter Insert Mode.
Change the ending of the line reading:
to
Press ESC
to leave Insert Mode and enter Command Mode.
Type :wq
+ ENTER
to save and quit.
Reload the command line:
Check out your newly themed command line and repeat steps 1-6 with a few more themes to find the best fit.
To see the full list of locally available zsh themes, follow these steps:
a. Change directories to the zsh themes folder:
b. List the names of all the available themes:
The autosuggestions plug-in is quite possibly the single most time-saving tool when coding. Instead of having to type the same command over and over again in full, this plug-in automatically suggests the rest of your command as you are typing, without even having to press TAB
.
For example, instead of having to type git push origin main
every single time you wish to push a new commit, you can instead type git push
and the command line will automatically show a preview of the rest of the suggested command based on your shell's history.
Follow these steps to install and enable the autosuggestions plug-in:
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
Edit the zsh configuration file:
a. Type vi ~/.zshrc
b. Press i
to enter Insert Mode.
c. Update the line beginning with plugins=(git)
to plugins=(git zsh-autosuggestions)
d. Press ESC
to leave Insert Mode and enter Command Mode.
d. Type :wq
+ ENTER
to save and quit.
Reload the command line for the changes to take effect:
Right Arrow
key to accept it.You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4