For those of you who spend a significant amount of time in a Linux or macOS terminal, you know having that dull default look on it is something that can grow boring in one way or the other. To enable you have that sumptuous look on your terminal, this guide takes on this road that leads to having well customized, simple, neat, fancy and pretty prompts.

This is meant to cheer up your working space, to improve the elegance of your door to the world and to enchant others to join your A rated camp. And we shall begin.

1. Spaceship

Adapted from its official website, Spaceship is a minimalistic, powerful and extremely customizable Zsh prompt. It combines everything you may need for convenient work, without unnecessary complications, like a real spaceship.

Features of Spaceship

  • Clever hostname and username displaying.
  • Prompt character turns red if the last command exits with non-zero code.
  • Current Git branch and rich repo status
  • Current Mercurial bookmark/branch and rich repo status
  • Indicator for jobs in the background (✦).
  • Current Node.js version, through nvm/nodenv/n (⬢).
  • Current Ruby version, through rvm/rbenv/chruby/asdf (💎).
  • Current Elm version (🌳)
  • Current Elixir version, through kiex/exenv/elixir (💧).
  • Current Swift version, through swiftenv
  • And much more

Requirements

Spaceship asks for the following in your computer so that it can work correctly for you.

  • zsh (v5.2 or recent) must be installed.
  • Powerline Font must be installed and used in your terminal (for example, switch font to Fira Code).

Installing Powerline Fonts manually

Spaceship requires Powerline font and we are going to install it first before we proceed to setup Spaceship. Get it installed as follows:

$ cd ~
$ git clone https://github.com/powerline/fonts.git

Cloning into 'fonts'...
remote: Enumerating objects: 968, done.
Receiving objects:  65% (633/968), 13.64 MiB | 1.74 MiB/s

After cloning the repository, change into the fonts directory and run the install script as follows:

$ cd ~/fonts/
$ ./install.sh

Copying fonts...
Resetting font cache, this may take a moment...
Powerline fonts installed to /home/vagrant/.local/share/fonts

Installing Powerline Fonts from OS repo

If you are running a Debian or Ubuntu based Linux distribution, there should be a package available to install the Powerline Fonts with the following command:

sudo apt-get install fonts-powerline

For Redhat based Linux distribution, there should also be a package available to install with the following command:

sudo dnf install powerline-fonts

Installing Spaceship

After you have fulfilled all the requirements that Spaceship needs, we can easily go ahead and install it to spice up your Zsh. Good thing about Spaceship is that you can get it installed in various ways. You can use npm, you can add it as part of your Oh-My-Zsh theme, Antigen theme or you can clone it and install it manually. We shall cover installation through some of them shared below.

Install via NPM

NPM is Node Package Manager and “spaceship-prompt” is one of the packages in its repository. You must have NPM installed prior to this:

npm install -g spaceship-prompt

Once it is installed, you will be required to simply reload your terminal or open a new one.

Install as part of Oh-My-Zsh

In case yo have integrated Oh-My-Zsh themes to your Zsh, no need to worry because Spaceship can work perfectly with oh-my-zsh. To set this up, clone this repo:

git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1

After that, symlink spaceship.zsh-theme to your Oh-My-Zsh custom themes directory like so

ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

Once that is done, we will need to update your user Zsh configuration file so that your terminal can read and reflect Spaceshift prompt. Open .zshrc and update ZSH_THEME line as follows:

vim ~/.zshrc
##Look for this part and edit accordingly
ZSH_THEME="spaceship"

After you are done editing, source the file so that the changes can reflect without logging out.

source ~/.zshrc

You should see something like

Best Terminal Shell Prompts for Zsh, Bash and Fish bash commands Featured fish How To Linux Tutorials productivity shell shell prompts terminal zsh

Install on Arch Linux

Install the latest master from the AUR package spaceship-prompt-git as follows:

git clone https://aur.archlinux.org/spaceship-prompt-git.git --depth=1
cd spaceship-prompt-git
makepkg -si

Find out more about Spaceship on their Official GitHub space and if you can kindly consider being their patron.

2. Starship

Starship call themselves the minimal, blazing-fast, and infinitely customizable prompt for any shell! And it is! It can be installed on all Platforms such as macOS, Windows and Linux distributions.

Features of Starship

The following are some of the goodies that Starship offers you:

  • Fast: it’s fast – really really fast! 🚀
  • Customizable: configure every aspect of your prompt.
  • Universal: works on any shell, on any operating system.
  • Intelligent: shows relevant information at a glance.
  • Feature rich: support for all your favorite tools.
  • Easy: quick to install – start using it in minutes.

Install the starship binary:

Run the following command in your shell to install latest version

$ curl -fsSL https://starship.rs/install.sh | bash

##Sample output

  Configuration
> Bin directory: /usr/local/bin
> Platform:      unknown-linux-musl
> Arch:          x86_64

> Tarball URL: https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-musl.tar.gz
? Install Starship latest to /usr/local/bin? [y/N] y
! Escalated permissions are required to install to /usr/local/bin
> Installing Starship as root, please wait…
✓ Starship installed

If you are on macOS, you can take advantage of Homebrew Package Manager to get the job done as follows

brew install starship

Once the installation is done, we are left with adding requisite configs to activate it in various shells.

Add the init script to your shell’s config file:

Bash

Add the following to the end of ~/.bashrc

$ vim ~/.bashrc
eval "$(starship init bash)"

Then source the file

source ~/.bashrc

You should see your terminal prompt change to something similar to the one below:

Best Terminal Shell Prompts for Zsh, Bash and Fish bash commands Featured fish How To Linux Tutorials productivity shell shell prompts terminal zsh

The same applies to the rest of the terminals.

Fish

Add the following to the end of ~/.config/fish/config.fish:

$ vim ~/.config/fish/config.fish
starship init fish | source

Zsh

Add the following to the end of ~/.zshrc:

$ vim ~/.zshrc
eval "$(starship init zsh)"

Then source the file

source ~/.zshrc

Ion

Add the following to the end of ~/.config/ion/initrc:

$ vim ~/.config/ion/initrc
eval $(starship init ion)

Finer configuration settings of Starship

Once that is done, one last thing remains; and that is configuring and/or polishing your Starship prompt to befit your tastes.

To get started configuring starship, create the following file: ~/.config/starship.toml.

mkdir -p ~/.config && touch ~/.config/starship.toml

All configuration settings you would need for your starship will be done in this TOML file we have just created. We can start off with some basic ones and add a few modules that it accommodates. Modules are components in the prompt giving information based on contextual information from your OS. For example, the “nodejs” module shows the version of NodeJS that is currently installed on your computer, if your current directory is a NodeJS project.

$ vim ~/.config/starship.toml
# Don't print a new line at the start of the prompt
add_newline = false

# Replaces the default "❯" symbol in the prompt with "➜"
[character]                             # The name of the module we are configuring is "character"
success_symbol = "[➜](bold green)"      # The "success_symbol" segment is being set to "➜" with the color "bold green"

# Disable the package module, hiding it from the prompt completely
[package]
disabled = true

The configuration above is meant to change the default prompt style from the default > to ➜

The moment to save the file, you should see your prompt change to the following cool arrow. What you should know is that, you can add any icon you like in that configuration file by replacing with ➜ it.

Best Terminal Shell Prompts for Zsh, Bash and Fish bash commands Featured fish How To Linux Tutorials productivity shell shell prompts terminal zsh

Adding the Battery module

The battery module shows how charged the device’s battery is and its current charging status. The module is only visible when the device’s battery is below 10%. Examples

$ vim ~/.config/starship.toml

##Add the following below the file
[battery]
full_symbol = "🔋"
charging_symbol = "⚡️"
discharging_symbol = "💀"

##The display configuration option is used to define when the battery indicator should be shown (threshold) and what it looks like (style).

[[battery.display]]
threshold = 10
style = "bold red"

[[battery.display]]  # "bold yellow" style when capacity is between 10% and 30%
threshold = 30
style = "bold yellow"

There are so many other modules that Starship provides which can be readily included into your configuration the moment they are needed. Follow Starship Modules page to find out the rest of them. They are easy to set us just like the way the battery module was straightforward to include. Good thing is that all configurations are included in the same file “~/.config/starship.toml

You can find out even more features and their respective configuration in Starship Main Website as well as their Main GitHub Page

3. Pure

Pure as the name suggests was developed with the mindset of simplicity, clarity and speed. The developers claim that most prompts are cluttered, ugly and slow. They figured that most people wanted something visually pleasing that stayed out of their way during their sweet terminal time.

Features of Pure

  • Comes with the perfect prompt character. Author went through the whole Unicode range to find it.
  • Shows git branch and whether it’s dirty (with a *).
  • Indicates when you have unpushed/unpulled git commits with up/down arrows. (Check is done asynchronously!)
  • Prompt character turns red if the last command didn’t exit with 0.
  • Command execution time will be displayed if it exceeds the set threshold.
  • Username and host only displayed when in an SSH session or a container.
  • Shows the current path in the title and the current folder & command when a process is running.
  • Support VI-mode indication by reverse prompt symbol (Zsh 5.3 ).
  • Makes an excellent starting point for your own custom prompt.

Installation of Pure

Pure can be installed using NPM or you can use the manual way if you like. Before we get into the details of getting Pure installed, you should know that it requires Git 2.15.2 and ZSH 5.2 . Older versions of ZSH are known to work, but they are not recommended. To get Zsh, kindly use the guide below.

Install Zsh on Linux and Configure

Install NPM

Incase you do not have Node Package Manager, you can get it installed easily using the guides below:

Install Node.js 14 on Ubuntu / Debian / Linux Mint

Install Node.js 14 on CentOS & RHEL

Once you are ready, proceed to get Pure installed thus:

npm install --global pure-prompt

The moment that is done, then we are ready to go.

Installing Pure Manually

Clone this repo somewhere. Here we’ll use $HOME/.zsh/pure.

##Ubuntu
sudo apt install git -y

##CentOS
sudo yum install git -y


$ mkdir -p "$HOME/.zsh"
$ git clone https://github.com/sindresorhus/pure.git "$HOME/.zsh/pure"

Add the path of the cloned repo to $fpath in $HOME/.zshrc.

$ vim  ~/.zshrc

fpath =$HOME/.zsh/pure

Getting started

Initialize the prompt system (if not so already) and choose pure by adding the two lines below the configuration file shown

$ vim ~/.zshrc
autoload -U promptinit; promptinit
prompt pure

After adding the configs in “~/.zshrc“, you can source the file or log out then log in again. Once you log in again , you should see your prompt change to something as shown below

Best Terminal Shell Prompts for Zsh, Bash and Fish bash commands Featured fish How To Linux Tutorials productivity shell shell prompts terminal zsh

Pure can be integrated with other tools you use to beautify your terminal such as oh-my-zsh, prezto, zim, antigen, antibody and the rest.

To integrate pure with oh-my-zsh, do the following

Set ZSH_THEME=”” in your .zshrc to disable oh-my-zsh themes.

Follow the Pure Install instructions as above

Do not enable the following (incompatible) plugins: vi-mode, virtualenv.

NOTE: oh-my-zsh overrides the prompt so Pure must be activated after source $ZSH/oh-my-zsh.sh.

For more information about Pure terminal prompt, they provide what the application in their main GitHub Page.

There we have it guys, you can pick one of the three terminal prompts to beautify, embolden and make your terminal a talk in the room by enhancing its look and its feel.

Closing Words

We have thus covered the installation of various prompts you can consider adding to your dear terminal and we hope all went well for you. From our side, we are grateful for the support you have shown throughout the year and we wish you the very best as you encounter new challenges and new horizons to conquer.

Other people also read:

How To Install Starship Shell Prompt for Bash / Zsh / Fish

10 Best Terminal Emulators for Linux

How to Customize Bash on Linux with Bash-it

Install Bashtop – Terminal Resource Monitor for Linux | macOS | FreeBSD

Best Console / Terminal File Managers for Linux