Customising terminal on Ubuntu.

So I’m getting to know this so going to show how I am customising my terminal. I may add updates to this post as I learn more.

Initially I have taken the lead from a few articles and YouTube videos to come up with something I like.

Firstly I’m just using the stock terminal that comes with Ubuntu

Stock Ubuntu terminal

First step is to install zsh

sudo apt install zsh

If you don’t have Git installed you’ll get an error saying it needs to be installed.

sudo apt install git

Then go to https://ohmyz.sh/#install and you’ll see the following command:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

The installation will ask you of you want to change your terminal to zsh, from the default bash. I don’t know of any problems with that and the articles I’ve seen haven’t mentioned any issues so I went ahead and did that. If anyone who’s more into Linux might read this and know of anything please comment below.

Next install the Autosuggestion plugin which remembers your previous commands and gives you a dim view of them as you type. PowerShell users might know this as part of the PSReadline module.

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

This clones the github repo to your home folder. You then need to edit the config file. If you don’t have gedit installed yet run the following (leave me alone Linux heads I’m still working up to Vim…)

sudo apt install gedit

The the file is called zshrc in your home folder so to edit with gedit

gedit ~/.zshrc

Towards the bottom there’s a plugins section that you need to list each plugin you want to load.

It should look like this

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)

Add the auto suggestions plugin with the following syntax

plugins=(git zsh-autosuggestions)

Then just reload file with

source ~/.zshrc

You should then see autocomplete working. You can test it by typing ‘g’ and the previous gedit command should come up.

Now let’s install a theme.

You can see available themes at https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

A popular one that’s not on there is called PowerLevel10k which is similar to the Windows Terminal theme I use so I’m going to use that.

Clone it first

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Then we’ll edit the .zshrc file again and change the theme to PowerLevel10k as per the documentation here. Mine was on line 18 yours should be same or similar.

ZSH_THEME=”powerlevel10k/powerlevel10k”

Leave a Reply

Your email address will not be published. Required fields are marked *