Setting Up Zsh on Your PC or VPS
Zsh (Z shell) is a powerful shell with improved features over bash, including better tab completion, spelling correction, and customizable prompts. Here's how to set it up:
Installation
Linux
# Ubuntu/Debian
sudo apt install zsh
# CentOS/RHEL
sudo yum install zsh
# Arch Linux
sudo pacman -S zshmacOS
macOS ships with Zsh by default since Catalina. For older versions:
brew install zshWindows
Install Windows Subsystem for Linux (WSL) and then install Zsh in your Linux distribution.
Making Zsh Your Default Shell
chsh -s $(which zsh)Installing Oh My Zsh
Oh My Zsh provides themes and plugins to enhance Zsh:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"Configuration
Edit ~/.zshrc to customize your setup:
- Change themes:
ZSH_THEME="robbyrussell" - Add plugins:
plugins=(git z zsh-autosuggestions zsh-syntax-highlighting zsh-completions zsh-interactive-cd alias-tips docker npm nvm macos fzf brew) - Set aliases:
alias ll="ls -la"
Must-Have Plugins
git: Git shortcuts and branch displayz: Jump quickly to directoriessyntax-highlighting: Command coloringautosuggestions: Fish-like suggestionsfzf: Fast fuzzy findernvm: Node version manageralias-tips: Show command aliaseszsh-completions: Additional completions
FZF Setup
macOS
brew install fzfLinux
sudo apt install fzfWindows
Install through WSL.
sudo apt install fzfVPS-Specific Setup
- Install through SSH: Same commands as above
- Ensure your
.zshrchas appropriate settings for non-interactive sessions - Consider lightweight themes for better performance
Final Touch
Restart your terminal or run source ~/.zshrc to apply changes.
With this setup, you'll have a powerful and customized terminal experience that will significantly improve your productivity when working on your PC or VPS.