If you are familiar with command line chances are you are using the default shell that came with your operating system that is bash. While there is nothing wrong with bash its kind of ugly looking out of the box and if you are inclined enough you can make bash do all the things zsh can but who's got the time for that?
So today we are going to look at zsh(Z Shell). Zsh too is kinda bland out of the box but the ecosystem around it makes it awesome.
All your bash scripts will still work with zsh so no need to worry about it.
Let's get started.
First we need to install zsh, i am using Fedora(a linux distro) you can follow the steps for your operating system.
sudo dnf install zsh
This will install zsh for us.
Now let's create a config file for zsh in our home directory.
Now that we are all setup let's get to the good part. Zsh has a plugin system, you can add and remove plugins as your hear desires, but managing these plugins can be a bit of a cumbersome task.
Enter Antigen, Antigen is a plugin manager for zsh which makes it a breeze to manage and install new plugins without all the hassle, now let's install Antigen.
You can follow the instructions on the Antigen github page but i'm also writing them here.
First let's download it.
curl -L git.io/antigen > ~/.antigen.zsh
Now let's tell zsh to use antigen by adding it to the config file. Add the following line to
source ~/.antigen.zsh # Note: make sure to add the correct path to your zshrc file.
Now you are all setup but you might have noticed that your shell still looks the same. That's because you haven't changed your default shell from bash to zsh, let's do it now.
chsh -s /bin/zsh # Note: don't use sudo
this will change your default shell, now log out and log back in to see the changes.
Now that you are all setup let's spice up our shell.
You might think of oh my zsh as a collection of plugins. It's a community run project and there are hundreds of plugins to fulfill your needs.
now that we are done with our oh my zsh primer let's tell antigen to use oh my zsh to fetch plugins, open up your
zshrc file and add the following lines to it.
antigen use oh-my-zsh # tell antigen to use oh my zsh # all your antigen config goes here antigen apply # apply the changes
You can get a full list of themes here.
once you have chosen a theme tell antigen to use that theme.
antigen theme your-theme-name # example : antigen theme robbyrussel
While themes are good, you need to get some work done on your machine and plugins can help you do them faster and be more productive. Some of the plugins i use are git plugin and the syntax highlighting plugin. dont go overboard with plugins as they can slow down your shell.
antigen bundle git # git plugin antigen bundle zsh-users/zsh-syntax-highlighting # syntax highlighting plugin
the git plugin can save you a lot of time, for example it has aliases for almost all the git commands, for example:
gst => git status
gp => git push
gaa => git add .
gcl => git clone
gc => git commit
you can find the complete list here.
source ~/.antigen.zsh # Load the oh-my-zsh's library antigen use oh-my-zsh antigen bundle git antigen bundle zsh-users/zsh-syntax-highlighting # Load the theme antigen theme gianu # Tell antigen that you're done antigen apply
One of the things i found hard was to manage my
zshrc file along with other dotfiles (config files), one simple solution i used was to use git to manage my config files and host them on github, that way i will have access to my config files everywhere
you can find my config files here.
Thanks for reading :)