Date Modified Tags Zsh / shell / bash

Zsh is a fantastic POSIX compliant bash replacement that I use daily. It fully supports all your normal bash commands and syntax but also adds a lot of cool plugins that have features like auto-completion.

Install it

sudo apt install zsh

Now install the plug-in manager for Zsh called Oh My Zsh:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Note that if you want to script the install of OMZ and want to skip entering the password you can just use this:

echo '\n' |  sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

The password prompt will fail and your shell wont be changed, but it wont hold up your script. (And you may not want to set it as default on a scripted server anyway...)

Make sure zsh is in your authorized shells list:

cat /etc/shells

Change to default shell (if that is what you want)

For most of the servers I deploy I don't want the default shell to be zsh and instead I just activate it when I need it by calling zsh.

However, on desktop you can make it your default shell with:

chsh -s $(which zsh)

Setup and install auto-completions

git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

Add the plugin to the list of plugins for Oh My Zsh to load:

vim ~/.zshrc

The plugins line should be changed to look something like this:

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
  git
  zsh-autosuggestions
)

Start a new terminal session and you should be done!


Comments

comments powered by Disqus