Replace your bash terminal with zsh

The Linux shell can be replaced with zsh to open up a world of extra plugins, features and themes. And it’s a pretty nice UX/UI upgrade from bash tbh.

My zsh shown below, has been complimented with oh-my-zsh and the p10k theme with customised prompt elements.

The left-side prompt elements are: battery (86%), os_icon (ElementaryOS), dir, disk_usage (8%).

The right-side prompt elements are: status (exit status 0), load (load average 1.11), time (11:02:59).

There are other prompt elements available and they are listed at the end of this post. Have fun!

Your mileage may vary between different terminals, e.g. blackbox, gnome-terminal etc. Try opening alternative terminal emulators once zsh is set up to see the differences if any, and just stick with the one that works best for you.

Installation

sudo apt-get update && sudo apt-get install zsh git

chsh -s $(which zsh)

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

mkdir -p ~/.local/share/fonts

cd ~/.local/share/fonts

curl -fLo "MesloLGS NF Regular.ttf" https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf

curl -fLo "MesloLGS NF Bold.ttf" https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf

curl -fLo "MesloLGS NF Italic.ttf" https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf

curl -fLo "MesloLGS NF Bold Italic.ttf" https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf

fc-cache -fv

In your terminal of choice, replace the default font with "MesloLGS NF"
You could also try Cascadia Code Nerd Font or some of the others listed here

Install oh-my-zsh

Install oh-my-zsh to enable a framework that allows easy customisation of zsh.

sudo apt install curl wget

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

Use the omz command to administer oh-my-zsh

More on using omz here

Install Powerlevel10K Theme for Zsh

Powerlevel10k or p10k is the coolest theme for zsh/oh-my-zsh and is an evolution of a fork of the famous powerlevel9k project.

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

Edit your ~/.zshrc file and change the theme to

ZSH_THEME="powerlevel10k/powerlevel10k"

After modification to the ~/.zshrc file, reload the config with,

source ~/.zshrc

When you first run the shell with the p10k theme installed, there is no config file set up, so a convenient wizard will automatically ask you some questions. More on the wizard here, but it’s fairly self-explanatory.

p10k has a number of customisable prompt elements. You will be prompted by a wizard upon first execution of the theme and it will run through various options/choices to create the .p10k.zsh config file sourced by your .zshrc file.

vi ~/.p10k.zsh and edit the left and right prompt elements contained in the following two sections.

typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
  os_icon
  dir
  vcs
  ...
)

typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
  status
  command_execution_time
  background_jobs
  ...
)

After any changes, 

source ~/.p10k.zsh

Add syntax-highlighting, auto-suggestion and auto-correction

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

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

Auto-correction exemptions
If you make a mistake, zsh will offer a correction.  If you have certain commands or words that are repeatedly prompted with autocorrection options, you can add them to the exemption list in ~/.oh-my-zsh/lib/correction so those words will be ignored.

Find and edit the load plugins line in ~/.zshrc
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

source ~/.zshrc

If you're happy everything works, change your default shell in /etc/passwd for your user to /usr/bin/zsh permanently.  This will not affect the root user when you sudo su - to elevate your privs to change to the root user for your system.

Prompt Elements

  1. os_icon: Operating system icon.
  2. dir: Current directory.
  3. vcs: Version control system (e.g., Git status).
  4. prompt_char: Prompt character.
  5. status: Exit status of the last command.
  6. command_execution_time: Duration of the last command.
  7. background_jobs: Indicator for background jobs.
  8. history: Command history number.
  9. time: Current time.
  10. date: Current date.
  11. battery: Battery status.
  12. user: Current user.
  13. hostname: Hostname of the machine.
  14. ip: IP address.
  15. load: System load.
  16. disk_usage: Disk usage.
  17. ram: RAM usage.
  18. swap: Swap usage.
  19. cpu: CPU usage.
  20. kubecontext: Kubernetes context.
  21. node_version: Node.js version.
  22. python_version: Python version.
  23. ruby_version: Ruby version.
  24. go_version: Go version.
  25. php_version: PHP version.
  26. java_version: Java version.
  27. aws: AWS profile.
  28. azure: Azure account.
  29. gcloud: Google Cloud account.
  30. terraform: Terraform workspace.
  31. nix_shell: Nix shell.
  32. context: Context (e.g., user@hostname).
Did you like this?
Tip cyberfella with Cryptocurrency

Donate Bitcoin to cyberfella

Scan to Donate Bitcoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to cyberfella

Scan to Donate Bitcoin Cash to cyberfella
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to cyberfella

Scan to Donate Ethereum to cyberfella
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to cyberfella

Scan to Donate Litecoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to cyberfella

Scan to Donate Monero to cyberfella
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to cyberfella

Scan to Donate ZCash to cyberfella
Scan the QR code or copy the address below into your wallet to send some ZCash: