Installation
- To begin, install zsh using your package manager. In this case, I’ll use pacman with the following command:
sudo pacman -S zsh
- Next, verify the newly installed zsh version:
zsh --version
- To confirm that you are using the new shell, check the current shell with:
echo $SHELL
- Now, open the /etc/passwd file with your preferred text editor. For example, you can use nvim:
sudo nvim /etc/passwd
- Within the file, find the line corresponding to your username and replace
/bin/bash
with/bin/zsh
. In my case, my username is rxtsel:
rxtsel:x:1000:1000::/home/rxtsel:/bin/bash
rxtsel:x:1000:1000::/home/rxtsel:/bin/zsh
- Save the changes and close the file.
- Change the default shell by running the following command:
sudo chsh -s /bin/zsh
- Continue by installing oh-my-zsh and git:
sudo pacman -S git &&sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
-
Restart your terminal to apply the changes.
-
Then, edit the
.zshrc
file with your favorite text editor, which should be in the root of the user folder/home/rxtsel/.zshrc
. In my case, I already have my customized configuration for WSL, but feel free to use the one you prefer:-
For this configuration, you will need to install the following plugins and programs:
-
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it willZSH_THEME="robbyrussell"
plugins=( sudo git zsh-syntax-highlighting )
source $ZSH/oh-my-zsh.sh
# CUSTOM ALIASalias zz="cd ~/.config"alias vim=nvimalias v=nvimalias vcfg="cd ~/.config/nvim/ && nvim init.lua"alias zr="source ~/.zshrc"alias -s {html,js,css,py,go,lua}="nvim"alias pro="cd ~/Projects"alias t="tmux"alias thunar="/mnt/c/Windows/explorer.exe ."
# fnmexport PATH="/home/rxtsel/.local/share/fnm:$PATH"eval "`fnm env`"
# bun completions[ -s "/home/rxtsel/.bun/_bun" ] && source "/home/rxtsel/.bun/_bun"
# bunexport BUN_INSTALL="$HOME/.bun"export PATH="$BUN_INSTALL/bin:$PATH"
- Restart your terminal to apply the changes.
Congratulations! Now you have Zsh installed, configured with oh-my-zsh, and your terminal is ready to be used efficiently.