ZSH Guide

· wordCount · 2 minute read

One of the core elements of a developers, operations, and security engineers system is having a powerful shell. This video is a guide on how to install, configure, and customize ZSH to make it beautiful and making your life easier when using your shell.

Video Guide

Installing ZSH

Lets get started by installing ZSH on our system.

Its very easy to install on almost every operating system as zshell is pretty much available from most package managers on Linux and MacOS:

# Debian / Ubuntu
apt install zsh

# Arch / Manjaro
pacman -S zsh

# MacOS
brew install zsh

The other tool we will be install is Oh My ZSH which is an open source framework for managing your ZSH configurations.

We can simply run a curl command to install Oh My ZSH:

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

The two main reasons for installing Oh My ZSH is the themes and plugins available to us which we’ll cover later.

Configuration and Customization

Themes

You can see a list of all the default themes built into Oh My ZSH.

~/.zshrc

# ZSH_THEME="robbyrussell"
# ZSH_THEME="fino"
ZSH_THEME="agnoster"

Plugins

You can find a list of all the default plugins built into Oh My ZSH.

~/.zshrc


# https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins
plugins=(
    # Tools 
	git
    docker
    kubectl
    tmux

	# OS
	debian
    macos

    # Programming Languages
	rust
    python

	# Misc
    colored-man-pages
	web-search
)

Tips && Tricks

Here is a bunch of tips and tricks that I think is useful to know.

Default Shell

If you want to run ZSH as your default shell on your system, you need to run the change shell command to set it for your user.

# Run Change Shell tool
chsh -s $(which zsh)

Using Dotfiles Repositpory

Check out my guide to using dotfiles

Adding Custom Aliases and Functions

Take a look at some of my bash scripts in my dotfiles GitHub repositpory.

https://github.com/GeekMasher/.dotfiles/tree/main/geek/.geek

Additional Plugins

You can also install additional plugins in ZSH that are outside of the default plugins.

Here are some of those that I think are worth bringing up:

# https://github.com/zsh-users

plugins=(
    # https://github.com/zsh-users/zsh-autosuggestions
    zsh-autosuggestions
    # https://github.com/zsh-users/zsh-syntax-highlighting
    zsh-syntax-highlighting
)

Neofetch

# Run neofetch if present on machine
if [ -x "$(command -v neofetch)" ]; then
    neofetch
fi

Resources