Terminal setup
Here’s how I customize my Ubuntu terminal with zsh, oh my zsh, and a couple of plugins.
Install zsh
sudo apt install zsh -y-yis short for--yesand it automatically answers “yes” to all prompts during the install.
zsh --version
# zsh 5.9 (x86_64-ubuntu-linux-gnu)Make zsh the default shell
chsh -s "$(which zsh)"Close the terminal (or log out) and come back so the login shell change takes effect. If you skip the restart you’ll still fall back to bash.
Install oh my zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"Oh My Zsh is essentially a curated collection of configuration defaults, plugin hooks, themes, and helper functions that keep your .zshrc simple. The installer creates ~/.oh-my-zsh plus a default .zshrc.
Add syntax highlighting and autosuggestions
Oh My Zsh exposes a $ZSH_CUSTOM folder meant for custom plugins. We can drop two essentials there:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
"${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting"git clone https://github.com/zsh-users/zsh-autosuggestions \
"${ZSH_CUSTOM}/plugins/zsh-autosuggestions"Then edit .zshrc and enable them:
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)Reload the shell (source ~/.zshrc) and you’ll get instant syntax colors plus ghosted suggestions while typing.
Add the Spaceship theme
Spaceship is a clean, information-dense theme. Install it into the custom themes directory and symlink it so Oh My Zsh can find it:
git clone https://github.com/denysdovhan/spaceship-prompt.git \
"${ZSH_CUSTOM}/themes/spaceship-prompt"ln -s "${ZSH_CUSTOM}/themes/spaceship-prompt/spaceship.zsh-theme" \
"${ZSH_CUSTOM}/themes/spaceship.zsh-theme"Update .zshrc:
ZSH_THEME="spaceship"Restart the terminal and you’ll see the new prompt with Git status, node versions, and other context.
Add the legendary z command
The z script tracks your directory history so you can jump to frequently used folders with a fuzzy match.
sudo mkdir -p /usr/local/etc/profile.d/ && \
sudo curl -fsSL https://raw.githubusercontent.com/rupa/z/master/z.sh \
-o /usr/local/etc/profile.d/z.shSource it from your .zshrc:
if [ -f /usr/local/etc/profile.d/z.sh ]; then
. /usr/local/etc/profile.d/z.sh
fiAfter a bit of navigation history I can run z blog and instantly land in ~/repos/daniel/blog.
Tips
- Open your terminal preferences and enable “Run command as a login shell” so
.zshrcruns for GUI terminals. - Keep your
.zshrcin a dotfiles repo and symlink it to~/.zshrcto sync across machines. - Whenever you add plugins or theme tweaks, re-run
source ~/.zshrcto check for errors immediately.