Tips for the best terminal shells for Zsh, Bash and Fish

You can download this article in PDF format via the link below to support us.Download the guide in PDF formatClose

For those who spend a lot of time on a Linux or macOS terminal, you know that the default appearance that is dull on it can become boring in one or more ways. In order for you to have a rich appearance on the terminal, this guide will follow this path, which will bring personalized, simple, neat, exquisite and beautiful tips.

This is to increase your working space, improve the elegance of the door to the world, and attract others to join your life. A + Rated campsite. We will start.

1. a spaceship

Adapted from Official website, Spaceship is a simple, powerful and highly customizable Zsh prompt. It combines everything needed to facilitate work, without the unnecessary complexity of a real spacecraft.

Features of the spacecraft

  • Show smart hostname and username.
  • If the last command exits with a non-zero code, the prompt character turns red.
  • Current Git branch and rich repo status
  • Current Mercurial bookmarks/branches and rich repo status
  • Background job indicator (✦).
  • The current Node.js version via nvm/nodenv/n (β¬’).
  • The current Ruby version, through rvm/rbenv/chruby/asdf (πŸ’Ž).
  • Current Elm version (🌳)
  • The current Elixir version, through kiex/exenv/elixir (πŸ’§).
  • The latest Swift version via swiftenv
  • And more

Claim

The spaceship requires you to perform the following operations in your computer so that it can work normally for you.

  • Must install zsh (v5.2 or higher).
  • The powerline font must be installed and used in the terminal (for example, switch the font to Fira Code).

Install powerline font manually

Spaceship requires the Powerline font, we will install it first before proceeding to set up Spaceship. Follow the steps below to install:

$ 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, go to the fonts directory and run the installation 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

Install Powerline font from OS repository

If you are running a Linux distribution based on Debian or Ubuntu, you should provide the package for installing the Powerline font using the following command:

sudo apt-get install fonts-powerline

For Redhat-based Linux distributions, there should also be a package that can be installed with the following command:

sudo dnf install powerline-fonts

Install spaceship

After you meet all the requirements of the spaceship, we can easily install it to add luster to your Zsh. The good thing about a spaceship is that you can install it in various ways. You can use npm, you can add it as part of the Oh-My-Zsh theme, the Antigen theme, or you can clone and install it manually. We will introduce the installation through the following shared part.

Install via NPM

NPM is the node package manager, and “Spaceship Tips” is one of the packages in its repository. Before that, you must first install NPM:

npm install -g spaceship-prompt

After the installation is complete, you will need to simply reload the terminal or open a new terminal.

Install as part of Oh-My-Zsh

If you have integrated the Oh-My-Zsh theme into your Zsh, you don’t need to worry because the spaceship can interact with My goodness. To set it up, clone this repository:

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

After that, link spaceship.zsh-theme to your Oh-My-Zsh custom theme directory as shown below

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

After completion, we will need to update your user Zsh configuration file so that your terminal can read and reflect Spaceshift prompts. Open .zshrc and update the ZSH_THEME line as follows:

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

After editing, please provide the source of the file so that the changes can be reflected without logging out.

source ~/.zshrc

You should see something like

Install on Arch Linux

Install the latest master server 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 more information about the spacecraft on their website Official GitHub space If you can consider becoming their patron.

2. Starship

The interstellar spacecraft claims to be the smallest, ultra-fast, and infinitely customizable hint of any shell! Yes! It can be installed on all platforms, such as macOS, Windows and Linux distributions.

Features of interstellar spacecraft

Here are some of the benefits Starship provides you:

  • Fast: very fast-really very fast! πŸš€
  • Customizable: configure all aspects of the prompt.
  • Universal: It can run on any shell and any operating system.
  • Smart: Display relevant information at a glance.
  • Rich functions: Support all the tools you like.
  • Simple: Quick installation-you can start using it in a few minutes.

Install the interstellar spacecraft binaries:

Run the following command in your shell to install the 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 using macOS, you can use the Homebrew package manager to complete the work as follows

brew install starship

After the installation is complete, all we are left is to add the necessary configuration to activate it in various shells.

Add the initialization script to the configuration file of your Shell:

Thump

Add the following to the end of ~/.bashrc

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

Then get the file

source ~/.bashrc

You should see the terminal prompt change to resemble the following:

Terminal

The same is true for the other terminals.

fish

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

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

sh

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

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

Then get the file

source ~/.zshrc

ion

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

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

Starship’s finer configuration settings

Once completed, the last thing remains. And configure and/or optimize the “Starship” prompts according to your preferences.

To start configuring Starship, create the following file: ~/.config/starship.toml.

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

All the configuration settings required by Starship will be completed in the TOML file we just created. We can start with some basic modules, and then add some modules that it can hold. A module is a component in a prompt, used to provide information based on contextual information from the operating system. For example, if your current directory is a NodeJS project, the “nodejs” module will display the version of NodeJS currently installed on your computer.

$ 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 above configuration aims to change the default prompt style from the default > ➜The moment you save the file, you should see the prompt change to the following cool arrow. What you should know is that you can add any icon you want in that profile by replacing it with replacing.

Starship bash second hint

Add battery module

The battery module displays the charging method of the device battery and its current charging status. The module is only visible when the battery level of the device is below 10%.example

$ 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"

Starship provides many other modules which can be included in your configuration immediately when needed. Follow the “Starship Module” page to find the remaining modules. They are easy to set up for us, just like the way the battery module is directly contained.The good news is that all configurations are contained in the same file~/.config/starship.toml

You can find more features and their respective configurations in the following locations The main website of the Starship And their GitHub homepage

3. Pure

As the name suggests, Pure was developed for simplicity, clarity and speed. The developers claim that most prompts are messy, ugly, and slow. They believe that most people want to be visually pleasing in their sweet terminal time without hindering them from moving forward.

Pure features

  • With perfect prompt characters. The author traverses the entire Unicode range to find it.
  • Show git branch and whether it is dirty (with *).
  • Use the up/down arrows to indicate when to make an unpushed/unpushed git commit. (Checking is done asynchronously!)
  • If the last command does not exit with 0, the prompt character turns red.
  • If the threshold is exceeded, the command execution time will be displayed.
  • The username and host are only displayed when in an SSH session or container.
  • When the process is running, the current path is displayed in the title, and it is displayed in the current folder and commands.
  • Support VI mode indication through reverse prompt symbol (Zsh 5.3+).
  • Provides a good starting point for your own custom prompts.

Install pure

You can install Pure using NPM, or you can use manual methods as needed. Before diving into the details of installing Pure, you should know that it requires Git 2.15.2+ and ZSH 5.2+. It is known that the old version of ZSH can be used, but it is not recommended. To get Zsh, please use the guide below.

Install Zsh on Linux and configure

Install NPM

If you don’t have Node Package Manager, you can easily install it using the following guide:

Install Node.js 14 on Ubuntu/Debian/Linux Mint Install Node.js 14 on CentOS and RHEL

When you are ready, follow the steps below to install:

npm install --global pure-prompt

The moment we finish, we can set off.

Install Pure manually

Clone this repository somewhere. Here, we will 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 repository to $fpath in $HOME/.zshrc.

$ vim  ~/.zshrc

fpath+=$HOME/.zsh/pure

getting Started

Initialize the system (if it has not been initialized), and select the pure system by adding two lines below the displayed configuration file

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

in”~/.zshrc“, you can get the file or log out and log in again. After logging in again, you should see the prompt change as shown below

Pure first hint

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

Set ZSH_THEME=”” in your .zshrc to disable the oh-my-zsh theme. Follow the “pure installation” instructions above and do not enable the following (incompatible) plugins: vi-mode, virtualenv. Note: oh-my-zsh will overwrite the prompt, so Pure must be activated after the source $ZSH/oh-my-zsh.sh.

For more information about the Pure terminal prompt, they provide the main application GitHub page.

Here, we can guys, you can choose one of the three terminal prompts to beautify, enhance and enhance the look and feel of the terminal, making your terminal a topic in the room.

Concluding remarks

Therefore, we have introduced the installation of various tips, you can consider adding them to your dear terminal, we hope everything is fine for you. On our side, we thank you for your support throughout the year and wish you the best achievements when encountering new challenges and conquering new horizons.

Others also read:

How to install Starship Shell Prompt for Bash/Zsh/Fish

10 best terminal emulators for Linux

How to use Bash-it to customize Bash on Linux

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

The best console/terminal file manager for Linux

You can download this article in PDF format via the link below to support us.Download the guide in PDF formatClose

Sidebar