Switching from Bash to ZSH (Oh-my-zsh)
07 Jan 2018For years I have used the default terminal shell that comes with Linux, Bash. Having looked at several dotfile projects on GitHub and also watching Wes Bos’ Command Line Power User free course, I thought it was time to look around at the other options available.
The Wes Bos course is a great watch if you have not already done so, and his teaching style is awesome. He also has tonnes of other courses.
Installing ZSH
sudo apt-get install zsh -y
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
Changing the shell
chsh -s `which zsh`
The above will require a logout or system restart.
Fixing Jekyll server
I had to do the following to ensure Jekyll was able to serve files locally (found here):
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv
echo 'eval "$(rbenv init -)"' >> ~/.zshenv
echo 'source $HOME/.zshenv' >> ~/.zshrc
exec $SHELL
1. Set the theme
- Edit the
~/.zshrc
filevim ~/.zshrc
and set:
ZSH_THEME="agnoster"
2. Choose the plugins
vim ~/.zshrc
plugins=(git command-not-found node sudo vagrant)
Don’t forget to then
source ~/.zshrc
3. Using z
for jumping to recent folders
cd ~/
- Download:
wget https://raw.githubusercontent.com/rupa/z/master/z.sh
- Make
z
available withZSH
:printf "\n\n#initialize Z (https://github.com/rupa/z) \n. ~/z.sh \n\n" >> .zshrc
- Reload shell:
source ~/.zshrc
Helpful link for this can be found here
Features
Folder search
Example (found on Google):
Advanced History
If you know the command, i.e git
but can’t remember the parameters you can type git
and then cycle through your previous Git commands pressing the up key.