Skip to content

Instantly share code, notes, and snippets.

@alexmacniven
Last active April 10, 2021 14:58
Show Gist options
  • Save alexmacniven/1d629c2e9d49ed8a42aa078d6ba551ed to your computer and use it in GitHub Desktop.
Save alexmacniven/1d629c2e9d49ed8a42aa078d6ba551ed to your computer and use it in GitHub Desktop.

Zsh and Oh-My-Zsh on Ubuntu WSL

Bash on WSL is great.

But if you want a little extra from your terminal you can install zsh and oh-my-zsh pretty easily.

Prequisites

  • Ubuntu WSL

Install Zsh

From a bash WSL terminal;

$ sudo apt install zsh

Check the version, oh-my-zsh requires 4.3.9;

$ zsh --version
zsh 5.4.2 (x86_64-ubuntu-linux-gnu)

Set Zsh as Default

We'll want to use zsh as our default shell;

$ sudo chsh -s $(which zsh)

The above should locate zsh and set it as the default shell.

Let's check;

$ echo $SHELL

If the above doesn't return a path to zsh then we can use another approach.

  • Open your bashrc file;
    $ vim ~/.bashrc
  • Add the following to the top of the file;
    bash -c zsh

Now we have zsh as our default shell.

Install oh-my-zsh

Simply execute the following;

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Agnoster Theme

One of the most popular themes is Agnoster.

Installing it is easy, firstly you'll need the Powerline Fonts

sudo apt-get install fonts-powerline

Then delve into your ~/.zshrc file and edit;

Old
------------------------
ZSH_THEME="robbyrussell"

New
------------------------
ZSH_THEME="agnoster"

Removing user@hostname

You can minimalise things a little by removing the user@hostname section of the prompt.

Into your ~/.zshrc again and add;

DEFAULT_USER="$USER"

Plugins

Active plugins are described in the plugins section of your ~/.zshrc

A comprehensive list can be found here

🚀

Copy link

ghost commented Dec 15, 2020

thx a lot dood, ❤️ 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment