How to install and configure Oh My Zsh on elementary OS
The default terminal in elementary OS is deliberately clean and uncomplicated, which suits everyday commands well. As your command-line habits grow, though, you may want clearer prompts, useful shortcuts, Git information and completion tools. Zsh provides the shell features, while Oh My Zsh supplies a manageable framework for themes and plugins.
Installing Oh My Zsh on elementary OS is straightforward because the distribution uses Ubuntu-compatible packages and repositories. You will need a working internet connection, a user account with sudo access, and a little patience while you decide which customisations genuinely help. A decorated prompt can look impressive, but a fast and readable terminal is usually more useful.
The process below keeps the changes reversible. It installs Zsh beside Bash, creates a backup of your shell configuration, changes your login shell only when you are ready, and explains how to undo the setup. That approach is useful on a laptop in Melbourne, a desktop in Brisbane, or a work machine connected through an occasionally temperamental NBN service.
| Component | Purpose | Recommended approach |
|---|---|---|
| Zsh | The shell that interprets commands | Install from the elementary OS package repositories |
| Oh My Zsh | Configuration framework for Zsh | Install with its official script after reviewing it |
| Theme | Controls the appearance of the prompt | Start with the included robbyrussell theme |
| Plugins | Adds aliases, completion and other conveniences | Enable a small selection in .zshrc |
| Default shell | Determines what opens in a terminal or login session | Change it with chsh after testing Zsh |
Prepare the system and install Zsh
Open Terminal from Applications, or use the keyboard shortcut configured on your desktop. Refresh the package index first, then install Zsh, Git and one download utility:
sudo apt update
sudo apt install zsh git curl
Git is needed for the Oh My Zsh installation, while curl downloads the installer. On a fresh elementary OS installation, these packages are normally available without adding a third-party repository. If apt update reports a repository error, fix that first rather than forcing the installation; an incomplete package index can cause unrelated problems later.
Check that Zsh was installed correctly:
zsh --version
You should see a version number rather than a “command not found” message. You can launch Zsh temporarily without changing your account’s default shell:
zsh
The first launch may display a configuration menu. Select the option to create a basic configuration file if one is offered. You can leave that temporary session with exit, or press Ctrl+D.
Before installing a framework, make a note of any existing shell customisation. Users who have previously added aliases, environment variables or development tools to ~/.bashrc should not assume those settings will automatically appear in Zsh. Keep Bash available until those commands have been moved or tested.
Install Oh My Zsh safely
Oh My Zsh is commonly installed with its official remote script. The curl command below downloads and runs that script:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
A remote installation script deserves a quick security check. If you prefer to inspect it before execution, download it first:
curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -o install-ohmyzsh.sh
less install-ohmyzsh.sh
sh install-ohmyzsh.sh
rm install-ohmyzsh.sh
The installer creates ~/.oh-my-zsh, generates a ~/.zshrc file if necessary, and usually offers to make Zsh your default login shell. It may ask for your password because chsh changes account information. If you are uncertain, decline that prompt for now and test Zsh manually.
If the installer reports that Oh My Zsh already exists, do not run it repeatedly. Check the directory and configuration instead:
ls -la ~/.oh-my-zsh
ls -la ~/.zshrc
A second installation can overwrite settings or leave confusing backups. When you are managing a dual-boot workstation, a clean setup is especially valuable; these dual-boot instructions cover the broader system arrangement, while Oh My Zsh only affects your Linux user account.
Once the installation finishes, start a new terminal window. If Zsh has become the default, its prompt should appear automatically. Otherwise, test it with:
zsh
Choose a practical theme and edit the prompt
Oh My Zsh includes several themes, and the default robbyrussell theme is a good starting point. It shows the current directory and Git branch without requiring additional fonts or a complicated prompt engine. Open the configuration file with the elementary OS text editor:
io.elementary.code ~/.zshrc
If that command is unavailable on your installation, use a terminal editor:
nano ~/.zshrc
Find the theme line:
ZSH_THEME="robbyrussell"
Keep it as written initially. To test another included theme, replace the value with a name such as agnoster, then reload the configuration:
source ~/.zshrc
Some themes use symbols that are not included in standard fonts. If you see empty squares, strange spacing or broken branch icons, switch back to robbyrussell or install a suitable Nerd Font later. A plain theme is often the sensible choice on an older laptop or a small screen.
You can make the prompt more informative without changing themes. Add this near the end of .zshrc:
PROMPT='%F{cyan}%n@%m%f:%F{blue}%~%f %# '
This displays your username, computer name and current directory. The %# symbol changes depending on whether the shell is running as a normal user or root. Avoid placing sudo commands inside prompt configuration, and never use a prompt that hides the current path when you are working across several project directories.
Themes can also expose useful Git information, but excessive status checks may slow the prompt in large repositories. If a theme becomes sluggish inside a substantial project, test a simpler theme before installing more plugins. Fast feedback matters when you are switching between code, package management and routine file work.
Add plugins without making the shell noisy
Plugins are enabled in the plugins=(...) line in .zshrc. A beginner-friendly configuration might look like this:
plugins=(git sudo zsh-autosuggestions)
The git plugin provides aliases and helper functions for common Git work. The sudo plugin lets you press Esc twice to add sudo to the previous command, which is handy after receiving a permissions error. Use that shortcut carefully: it is still your responsibility to understand what the command will do as root.
zsh-autosuggestions is not included in the core Oh My Zsh collection, so install it separately by cloning its repository:
git clone https://github.com/zsh-users/zsh-autosuggestions \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Then add its name to the plugin list and reload:
source ~/.zshrc
As you type, the plugin displays a faint suggestion based on your command history. Press the right arrow key to accept it. This can save time with long commands, but avoid relying on suggestions blindly, particularly when a command contains a path, a remote host or a destructive option.
You can also add syntax highlighting:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Place zsh-syntax-highlighting last in the plugin list:
plugins=(git sudo zsh-autosuggestions zsh-syntax-highlighting)
The plugin order matters because syntax highlighting should load after other command-related plugins. If the terminal starts slowly, remove one plugin at a time and compare. A lean configuration is easier to maintain when you are troubleshooting a project on a Perth internet connection or working offline during travel.
Make Zsh the default and maintain it
After testing your aliases, prompt and plugins, check the current login shell:
printf '%s\n' "$SHELL"
If it still shows Bash, change the default with:
chsh -s "$(command -v zsh)"
Log out of elementary OS and sign in again, then open Terminal. The new shell should start automatically. You can verify the running shell with:
ps -p $$ -o comm=
The output should be zsh. Changing the default shell affects new login sessions, not every terminal process that is already open. Close old terminal windows if the result appears inconsistent.
Your personal configuration lives in ~/.zshrc. Before making substantial changes, create a dated backup:
cp ~/.zshrc ~/.zshrc.backup-$(date +%F)
It is also useful to keep a short record of manually installed plugins and themes. Oh My Zsh updates its framework with:
omz update
This updates the framework and its bundled components, but it does not automatically update every custom plugin. For custom Git-based plugins, enter their directories and use git pull only when you trust the upstream project and understand its changes.
Do not copy your entire .bashrc into .zshrc. Some Bash-specific syntax, completion commands or environment setup may fail in Zsh. Move useful lines individually, checking whether they are shell-neutral. Exported variables such as PATH often transfer easily, while Bash functions and prompt code may need rewriting.
Fix common problems and restore the old shell
A blank or broken prompt usually points to a syntax error in .zshrc, a missing theme, or an incorrectly installed plugin. Start Zsh without user configuration:
zsh -f
If the clean shell works, the issue is inside .zshrc. Open it and temporarily comment out recent additions by placing # at the start of each suspect line. Reload the file after every small change:
source ~/.zshrc
When a plugin cannot be found, confirm its directory exists:
ls -la ~/.oh-my-zsh/custom/plugins
The plugin name in plugins=(...) must match its directory name. A common mistake is installing a plugin under a slightly different spelling. If a theme fails, use the built-in default temporarily and confirm that the rest of the configuration loads.
If Zsh exits immediately, choose Bash for the current terminal by running:
bash
To restore Bash as the login shell:
chsh -s "$(command -v bash)"
Sign out and back in for the change to take effect. Keep the backup of .zshrc until the new setup has worked reliably for several sessions.
To remove Oh My Zsh while leaving Zsh installed, use its uninstall script:
uninstall_oh_my_zsh
You can then remove or rename the configuration file:
mv ~/.zshrc ~/.zshrc.before-oh-my-zsh
This preserves your settings for reference. If you want to remove Zsh itself, restore Bash first and then run sudo apt remove zsh; removing a package before changing the login shell can leave an account pointing at a shell that no longer exists.
A sensible final configuration is modest: Zsh as the shell, the standard Oh My Zsh theme, Git support, and one or two plugins that solve a real problem. On an elementary OS desktop, that gives you better command completion and useful context without turning the terminal into a slow wall of decoration. Back up ~/.zshrc, test changes in a new window, and keep Bash available until your everyday commands work as expected.