The default Ubuntu Terminal app is not that great (and probably the macOS’ one is even worse). But it does take minimal effort to set up a few basic tools that will help Terminal productivity a lot.
My setup is based on the Zsh shell, with the Oh-My-Zsh framework and the powerlevel10k theme. In addition, I use the following plugins:
- git
- macos or ubuntu (depending on the system you are using)
- zsh-autosuggestions
- zsh-completion
- [zsh-syntax-highlighting](https://github.com/zsh-users/> zsh-syntax-highlighting)
In this guide, you will learn how to set up a similar configuration.
Prerequisites
- This is not a tutorial on how to use the Terminal, I suppose that you already know the basics.
- You also need a working Linux system.
- Most steps are almost identical if you are on macOS.
- Finally, you need Git to install the powerlevel10k theme and some Zsh plugins.
Zsh Setup
You can skip this step if you are on macOS 10.15 (Catalina) or above: Zsh is already the default shell.
Zsh is a shell that is built on top of Bash, the default Ubuntu shell. For most purposes, what you can do in Bash you can do also in Zsh.
Use the following commands to install Zsh.
Once Zsh is installed, you need to set it as the default shell. While there is a command to change the login shell, gnome-terminal
will still default to use Bash1.
You can force it to use the new shell following these steps:
- Open a new Terminal window (
ctrl + alt + T
) - Click on
Terminal > Preferences
on the top left side of the screen. - Under
Profiles
, selectdefault
to modify the default profile. - Navigate to the
Command
tab - Check both boxes
- Run command as a login shell
- Run a custom command instead of the login shell
- Write
zsh
in the Custom command text box - Set the When command exits dropdown menu to
Exit the terminal
- Close the preferences and the Terminal window.
Next time you will open the tab, Zsh will be used instead of Bash. From now on, shell configurations (aliases, etc.) should be added to the .zshrc
file.
Setup Oh-My-Zsh
Oh-My-Zsh is an open-source framework to manage the Zsh configuration. Briefly, it makes it easier to customize the shell configuration and install plugins.
Installation is quick: you need to paste a command into your Terminal. Reference the documentation to know which command you must use.
[!note] The
.zshrc
file provided by Oh-My-Zsh is very well commented and can offer details in case you get stuck during some customization.
Install powerlevel10k Theme
powerlevel10k is a theme for the Zsh shell: good customization, with tons of features that will help you when using git or other tools. It is also very fast.
Also in this case, installation is really quick, you only need to clone a git repo. Check the documentation to know the exact command for Oh-My-Zsh users.
Once you cloned the repo, do the following:
- Open a new Terminal window.
- Open the
.zshrc
file (for example withnano .zshrc
). - Set the
ZSH_THEME
variable to"powerlevel10k/powerlevel10k"
. - Close the editor (
ctrl + X
andY
in case ofnano
).
Once you reopen the Terminal app, the theme configuration will take place. Follow the instructions and choose the settings you prefer.
[!note] To change your settings later on, you can trigger the configuration process by typing
p10k configure
.
Installing Plugins
There is a plethora of plugins for the Zsh shell. I like to keep my list small, but you can find the STANDARD plugin list on GitHub.
The STANDARD plugins are the ones already installed with the Oh-My-Zsh framework. To enable them:
- Open the
.zshrc
file. - Search for the
plugins
variable (near the end of the file). - Add the list of plugins you want to use between parentheses, separated by a single space. In my case, I have
There are also some other plugins, developed and supported by the community. To use them
- Clone the plugin GitHub repo into
.oh-my-zsh/plugins/
. - Add the repo name to the
plugins
variable like with standard plugins.
I like to use the following plugins:
- zsh-syntax-highlighting → fish-shell like syntax highlighting
- zsh-completion → improve shell auto-completion
- zsh-autosuggestions → improve auto-completion based on shell history
In the end, my plugins
variable is
Conclusion
If you followed the complete tutorial, you should have a very fast and visually pleasing Terminal, with auto-completion and syntax highlight. You can go on to customize your setup as you prefer.
Enjoy!