ZSH in 8 minutes

The Indian Techie
3 min readJan 25, 2021

--

If you’re a developer or someone who spends a lot of time in the terminal, you’ve likely heard of zsh, Zsh, or Z Shell, which is a powerful shell that offers many advantages over the default bash shell. It has a ton of useful features like tab completion, advanced history search, and auto-correction.

In this blog post, we’ll go over the steps to set up zsh on your system and customize it to fit your workflow.

Step 1: Install zsh

The first step to setting up zsh is to install it on your system. If you’re using a Unix-based system like macOS or Linux, you can install zsh using your package manager.

On macOS, you can use Homebrew to install zsh:

brew install zsh

On Debian-based Linux distributions like Ubuntu, you can use apt-get:

sudo apt-get install zsh

Once you’ve installed zsh, you can verify that it’s installed correctly by running:

zsh --version

Step 2: Set zsh as your default shell

The next step is to set zsh as your default shell. This ensures that every time you open a terminal window, zsh will be the default shell.

To do this, you’ll need to add the following line to your shell configuration file:

echo "exec zsh" >> ~/.bashrc

This line will add the exec zsh command to your .bashrc file, which will ensure that zsh is executed every time you open a terminal window.

Alternatively, you can add the same line to your .zshrc file:

echo "exec zsh" >> ~/.zshrc

This line will add the exec zsh command to your .zshrc file, which will ensure that zsh is executed every time you open a terminal window.

Step 3: Customize zsh

One of the great things about zsh is that it’s highly customizable. There are many plugins and themes available that can help you streamline your workflow and make your terminal more pleasant to use.

Oh My Zsh

One popular way to customize zsh is to use Oh My Zsh, a community-driven framework for managing zsh configurations. Oh My Zsh comes with a ton of plugins and themes that you can use to customize your terminal.

To install Oh My Zsh, you can run the following command:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Once you’ve installed Oh My Zsh, you can start customizing your terminal. You can choose a theme by editing your .zshrc file and changing the ZSH_THEME variable agnoster is my personal favorite:

ZSH_THEME="agnoster"

You can also enable plugins by adding them to the plugins variable:

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

plugins=(git zsh-syntax-highlighting zsh-autosuggestions)

Custom aliases

Another way to customize zsh is to create custom aliases. Aliases are shortcuts that allow you to execute commands more quickly and efficiently.

To create an alias, you can add the following line to your .zshrc file:

alias ll='ls -alF'

This alias will allow you to type ll instead of ls -alF to list all files and directories in the current directory.

Conclusion

In this blog post, we’ve covered the basics of setting up zsh and customizing it to fit your workflow. With zsh, you can streamline your terminal experience and make your work more efficient.

--

--