Setup Zsh
Written on March 16, 2015
Estimated reading time :
2 mins
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 :
References
- http://abstraction.blog/the-best-shell-for-linux/
- http://en.wikipedia.org/wiki/Z_shell
- http://blog.coolaj86.com/articles/zsh-is-to-bash-as-vim-is-to-vi.html
- http://mikebuss.com/2014/04/07/customizing-prezto/
- https://scottlinux.com/2011/08/19/quick-intro-to-zsh-auto-complete/
- http://mikebuss.com/2014/02/02/a-beautiful-productive-terminal-experience/
- Advanced customization of Zsh : http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
- http://zanshin.net/2013/02/02/zsh-configuration-from-the-ground-up/