Table of Contents
Ubuntu Install Oh-My-Zsh
In order to use “Oh My Zsh” you will need to have the zsh shell installed and enabled as your default shell.
Installing Zsh
sudo apt install zsh
Determine the path for zsh
which zsh
Next change your shell to zsh assuming here that the path we got above was /usr/bin/zsh
chsh -s /usr/bin/zsh
Now log out and into your system again for changes to take effect.
Unlike other shells zsh comes with a configuration menu the first time you launch it. Select the following.
1: Continue to main menu 1: Again configure settings for history. And here press 1 2 and 3
Press “0” remember the changes, and once back on the main menu and here press “0” again to save the configuration.
Installing Oh-My-Zsh
Oh My Zsh can be installed using either curl or wget
Install Using Curl
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Install Using Wget
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
Tweaks
I suggest adding a few plugins.
vi .zshrc
Find this line:
plugins=(
And add the following plugins.
git colored-man-pages
All plugins listed on the plugins Github page are pre-installed with Oh-My-Zsh at ~/.oh-my-zsh/plugins. Custom plugins can be installed at ~/.oh-my-zsh/custom/plugins. To use a plugin, you can simply add it to the plugins list in your ~/.zshrc file. Add wisely, as too many plugins slow down shell startup. Leave a blank between each plugin.
Pro Tip: Another great plugin is syntax highlighting and zsh-autosuggestions theese plugins are not preinstalled with Oh-My-Zsh.
Installing Syntax Highlighting
cd ~/.oh-my-zsh/custom/plugins git clone https://github.com/zsh-users/zsh-syntax-highlighting
Installing Zsh Autosuggestions
cd ~/.oh-my-zsh/custom/plugins git clone https://github.com/zsh-users/zsh-autosuggestions
Then enable the pluings by adding them to the .zshrc file.
vi .zshrc
Find this line:
plugins=(
And add the following plugins.
zsh-syntax-highlighting zsh-autosuggestions
Changing The Prompt
For this we are going to use the default theme which is called “robbyrussell.zsh-theme”
vi ~/.oh-my-zsh/themes/robbyrussell.zsh-theme
We are looking to change the first line. Look for %c and change it to either:
- %~ (For shorten home dir i.e ~/.oh-my-zsh/themes) or
- %d (For long home dir i.e /home/username.oh-my-zsh/themes)
Running The Configuration Again
Once you done the initial configuration you will not be asked again. You can however run it manual like this.
autoload -Uz zsh-newuser-install zsh-newuser-install -f
Changing The Theme
In this example we will change the default theme to agnoster. The agnoster theme requires a special font so let's install that first.
sudo apt install fonts-powerline
Next change to the new theme.
vi ~/.zshrc
Change the following:
ZSH_THEME="robbyrussell"
To:
ZSH_THEME="agnoster"
Close and reopen your terminal.
Uninstall Oh My Zsh
Open a terminal at type
uninstall_oh_my_zsh
Uninstall Zsh And Swich To Bash
Open a terminal and type
chsh -s $(which "bash") apt --purge remove zsh
If you installed zsh as root you also need to remove zsh like this.
chsh -s $(which "bash") sudo apt --purge remove zsh
Now log out and in to your system, in some extreme cases you may need to reboot.