Setup Zsh

Written on March 16, 2015
Estimated reading time : 2 mins
Tags : | bash | shell | zsh |

I had done this research quite a long time back. Adding to the blog now.

Objective

This document provides information on installing Zsh (pronounced as Zash or Zee-shell) on an Ubuntu machine & checking out some cool features.

Background Info

  • The Z shell (zsh) is a Unix shell that can be used as an interactive login shell and as a powerful command interpreter for shell scripting.
  • Zsh can be thought of as an extended Bourne shell with a large number of improvements, including some features of bash, ksh, and tcsh.

Prerequisites

  • You should have Ubuntu machine 1.5Ghz processor.
  • You should have minimum knowledge of Unix commands like ps, cd, cp, chmod, etc.
  • You should know what is Zsh.

Setup Zsh

/* Install zsh */
sudo apt-get update
sudo apt-get install zsh

/* Set zsh as default shell */
sudo chsh -s $(which zsh) $(whoami)

/* Customize */
vim ~/.zshrc

Setup Framework

  • No matter which framework you chose, add your aliases file if you want to link it from your earlier bash profile:
    • source ~/.bash_aliases
  • Then save the .zshrc file & reload the terminal.

oh-my-zsh Vs prezto

  • oh-my-zsh is the original community driven configuration management framework while prezto has been forked from it.
  • prezto is faster
  • oh-my-zsh has a larger number of themes & plugins

Setup Prezto

  • Installation :
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"

setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
  ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
  • Select theme & plugins in the ~/.zpreztorc file
  • Type prompt -l to show available themes.
  • My personal favourite theme is paradox though it is a bit complex to setup.
  • Alternatively you can create or customize existing themes in the folder /usr/share/zsh/functions/Prompts/ OR ~/.zprezto/modules/prompt/functions/ folder

Setup oh-my-zsh

  • Installation
    sudo wget --no-check-certificate http://install.ohmyz.sh -O - | sh
    
  • Select one of the themes in http://zshthem.es/all/ based on what info you need. by setting the ZSH_THEME.
  • My personal fav themes from the basic ones are “xiong-chiamiov-plus”, “smt” & “gnzh”.
  • Alternatively you can use “random” to cycle between various themes :
    • ZSH_THEME=”gnzh”
  • Activate Plugins by setting specific plugins of oh-my-zsh
    • plugins=(git command-not-found)

An example of how well you can customize your Zsh terminal :

Zsh Power

References





Feel free to share this article :

submit to reddit

Add your thoughts, questions, doubts, suggestions as comments below :