Make BASH nicer, make it shine.

As I as many of you spend most of my time in a terminal, why not make it shine a little. As everyone know, ZSH is easy to rice, but you can almost as easy rice your BASH shell.

Share
Make BASH nicer, make it shine.

I'm using Oh My Bash for this example, it's really easy to install and setup. I think the more popular Starship is a little too much.

Do I need to use Oh My Bash for this? Of course not. All of it can be setup, setting values and/or calling add-ons. But it saves time.

Installation

Prerequisites

You need to have the following installed:

  • curl or wget should be installed
  • git should be installed
  • A nerd font, if your chosen theme needs one.
    My favorite is the JetBrainsMono Nerd Font

Manual Installation

1. Clone the repository

git clone https://github.com/ohmybash/oh-my-bash.git ~/.oh-my-bash

2. Backup your existing ~/.bashrc file

cp ~/.bashrc ~/.bashrc.orig

3. Create a new sh configuration file

You can create a new sh config file by copying the template that we have included for you.

cp ~/.oh-my-bash/templates/bashrc.osh-template ~/.bashrc

4. Reload your .bashrc

source ~/.bashrc

5. Initialize your new bash configuration

Once you open up a new terminal window, it should load sh with Oh My Bash's configuration.

One-liner Installation ⚠️

Oh My Bash is installed by running one of the following commands in your terminal. You can install this via the command-line with either curl or wget.

⚠️
Newer pipe any script you download from the network into a shell (sh, bash ...). The following two examples are from the official GitHub page of Oh My Bash

Using curl ⚠️

bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"

Using wget ⚠️

bash -c "$(wget https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh -O -)"

This replaces ~/.bashrc with the version provided by Oh My Bash. The original .bashrc is backed up with the name ~/.bashrc.omb-TIMESTAMP. If ~/.bash_profile does not exist, this also creates a new file ~/.bash_profile with the default contents.

Notes

⚠️ If ~/.bash_profile already existed before Oh My Bash is installed, please make sure that~/.bash_profile contains the line source ~/.bashrc or . ~/.bashrc. If not, please add the following three lines in ~/.bash_profile:

if [[ -f ~/.bashrc ]]; then
  source ~/.bashrc
fi

Using Oh My Bash

Selecting a Theme

The font theme is the default one. It's not the fanciest one. It's not the simplest one. Likewise, it's just the right one for the original maintainer of Oh My Bash.

Once you find a theme that you want to use, you will need to edit the ~/.bashrc file. You'll see an environment variable (all caps) in there that looks like:

OSH_THEME="font"

To use a different theme

To use a different theme, simply change the value to match the name of your desired theme. For example (this is one of the fancy ones):

OSH_THEME="absimple" 

or let the system choose random themes:

OSH_THEME="random"

Make it work: source .bashrc

you might need to install a special Nerd font or the Powerline font on your console's host for this to work, I'm using zork, but if you like one with more bling, try agnoster

Setup plugins

To add a plugin, you need to add it to the configuration. Edit and add it:

plugins=(... colored-man-pages)

You can also try to color other pages by prefixing the respective command with colored: colored git help clone



References

Oh My Bash [1] Themes [2] Plugins [3] Nerd Fonts [4] Oh My Posh [5] Starship [6]


  1. OMB homepage, getting started GitHub ↩︎

  2. Thems, for more themes see the wiki page ↩︎

  3. Plugins GitHub see the wiki ↩︎

  4. Nerd Fonts Home page ↩︎

  5. Oh My Posh homepage and on GitHub ↩︎

  6. Starship homepage and on GitHub ↩︎