Linux zsh Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki

Linux zsh Guide

Complete beginner-friendly guide to zsh shell on Linux, covering Arch Linux, CachyOS, and other distributions including installation, Oh My Zsh, and shell customization.


Table of Contents

  1. zsh Installation
  2. zsh Configuration
  3. Oh My Zsh
  4. zsh Plugins
  5. Troubleshooting

zsh Installation

Install zsh

Arch/CachyOS:

# Install zsh
sudo pacman -S zsh

# Install zsh-completions
sudo pacman -S zsh-completions

Debian/Ubuntu:

sudo apt install zsh

Fedora:

sudo dnf install zsh

Set as Default

Change shell:

# Check current shell
echo $SHELL

# Change to zsh
chsh -s /bin/zsh

# Log out and back in

zsh Configuration

Configuration File

Edit config:

# Create config
vim ~/.zshrc

Basic Settings

Common settings:

# Enable completion
autoload -U compinit
compinit

# History settings
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000

# Enable colors
autoload -U colors && colors

Oh My Zsh

Install Oh My Zsh

Installation:

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

Oh My Zsh Themes

Change theme:

# Edit .zshrc
vim ~/.zshrc

# Change theme
ZSH_THEME="robbyrussell"

zsh Plugins

Enable Plugins

Add plugins:

# Edit .zshrc
plugins=(
  git
  docker
  python
  node
)

Popular Plugins

Install plugins:

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

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

Troubleshooting

zsh Not Working

Check installation:

# Check zsh
which zsh
zsh --version

# Install if missing
sudo pacman -S zsh

Summary

This guide covered zsh installation, configuration, and Oh My Zsh setup for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.