Getting started with ZSH on Ubuntu (for technotards)
- You're running Ubuntu Linux because you followed one of these tutorials
- The safest and easiest way to install Ubuntu from Windows
- Using an Amazon EC2 Instance as an Ubuntu VPS
- OR you already know about linux and you're just here to learn about zsh
- You've learned the basics of bash (how to use
- At the very least you understand the basics of vim (for people who'd rather not be using vim)
What is ZSH and why would I want it?
Also check out this vid from UTOSC 2012 by Seth House: Zsh: A high-level overview of shell-use and scripting
zsh is an improvement upon
It makes Terminal easier to use for beginners (and experts).
oh-my-zsh is a set configurations for
It's meant for people who want to use zsh,
but don't want to learn a lot about it and set it up themselves.
- It detects many typos
- It autocompletes better than bash
- You can push a directory (move into it) just by typing the directory's name (look ma, no pushd!)
- It's very polite (asks you what you mean to do)
- It will tell you which git branch you're on and if your
git statusis dirty
- You can use
..., etc up to n dots to go to an ancestor directory.
Most of the programs that end in
sh are shells
(i.e. sh, ash, dash, bash, zsh).
They're all nearly identical, but each succeeds the previous by being easier
to use and having more features.
Before you can use ZSH, you'll have to install it.
Although you only need to install zsh to have a working zsh, curl and git are needed to install oh-my-zsh in the following step.
vim is needed because... well, it's vim!
Open Terminal by searching for it in Dash (the upper left-most button in Launcher) and then copy and paste all of these lines (all at once) into Terminal.
sudo apt-get update && \ sudo apt-get install -y \ curl \ vim \ git \ zsh
Once you've pasted that, hit the
If you're asked for your password, type it in
(you won't see any *'s, but that's okay, it's working)
The default installation of ZSH requires a fair number of steps before it's all set up and working optimally.
By installing Oh My Zshell, we can skip the configuration step.
Run this command in Terminal the same way you ran the install command above.
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | bash
Once it completes, go ahead and run the command
You should see some colors change.
Congratulations, you're running zsh!
A note to experts:
On the zsh website they list
| sh, but the script is, in fact, meant for
bash and it won't run on
dash, which is what Ubuntu links
See for yourself:
ls -l /bin/sh.
Setting ZSH as the default shell (instead of bash)
As of right now, Terminal will always run BASH by default. Now we'll change it to run ZSH instead.
(I'm assuming you've copied and pasted enough commands at this point that I don't need to tell you to do that with this one)
sudo chsh -s $(which zsh) $(whoami)
Note to the experts:
You should check in your
~/.bashrc for any configuration
that you may have unwittingly added and need to be copied over.
For example, it's quite common to forget
For example, you might see output that looks like this (to be clear, I'm not asking you to run these, so don't type them - although it won't hurt if you do)
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting [[ -s "/home/`whoami`/.rvm/scripts/rvm" ]] && source "/home/`whoami`/.rvm/scripts/rvm" >> ~/.zshrc
You'll probably want to choose a theme to use. You can take a look at many of the ones available here:
Make sure that it's in
For example, if I want to make sure the theme
bira exists I would do this
(but you should substitute
bira for the theme you're interested in)
ls ~/.oh-my-zsh/themes/ | grep 'bira'
If you're not sure which to pick, I highly suggest
so that you get a chance to preview a different one each time
you open terminal and
then you can decide which to stick with later.
To set the theme you'll need to change
If you just can't decide, my current favorite is intheclear. Maybe you'll like it too!
By AJ ONeal
Was this useful to you? Share it!give me a tip or hire me.