Fancify Bash Terminal with Bash-It

If you are a bash user and are jealous of zsh users getting tons of fancy themes and plugins with Oh-My-Zsh, you are at the right place. In this tutorial, we will take a look over Bash-It, a community-driven Bash framework that essentially tries to mirror Oh-My-Zsh in capabilities and functionalities.

What is Bash-It?

Bash-it is a collection of community Bash commands, scripts, and themes that try to improve your experience with bash. This includes tab autocomplete, managing custom commands, maintaining aliases, etc.

If you always struggle to keep track of your nifty scripts and keep polluting your /bin/ or ~/.bashrc, then Bash-It is just for you.

How to install Bash-It?

To install Bash-It, we need to clone the repository and then run the installation script in the repository.

git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it
~/.bash_it/install.sh

Bash It Install

Changing themes in Bash-It

The default theme used by Bash-It is ‘Bobby’. This can be changed by changing the $BASH_IT_THEME environment variable.

All the themes are available in $BASH_IT/themes. You can see the example of those themes here.

Bash It Themes
Bash It Themes

To change the theme, go to ~/.bashrc and look for the following code snippet.

# Lock and Load a custom theme file.
# Leave empty to disable theming.
# location /.bash_it/themes/
export BASH_IT_THEME='bobby'
Change Bash It Theme

Here you can change ‘bobby’ to any theme present in your themes folder. I personally really like the ‘Wanelo’ theme.

Wanelo Theme 1
Wanelo theme
Kitsune Theme 1
Kitsune Theme

Plugin manager

All the Bash_it plugins are in $BASH_IT/plugins/available . You can add your custom plugins here. The default plugins include Alias completion, Git integration, Jekyll integration, AWS integration, etc.

Bash Plugins

Alias manager

The aliases are available in $BASH_IT/aliases/available.

Bash It Aliases

Here, as an example, I will show the process to use apt.aliases.bash which is an alias list for apt commands.

Step 1: Source apt.aliases.bash using the following command

source apt.aliases.bash

There is a possibility that it will throw an error stating that shellcheck is not installed in which case install shellcheck using the following command.

sudo apt install shellcheck

Now you can use all the aliases in that particular file.

Bash It Alias Example
Using ‘apts’ alias instead of apt-cache search

Step 2: This change will however go away when you open a new instance of the terminal. For this reason, I will add the following line in my ~/.bashrc so that it gets loaded every time I open the terminal.

source "$BASH_IT"/aliases/available/apt.aliases.bash
Make Permanent Changes Aliases Bash

This can be done to load any alias or script in Bash_IT.

Where can I find a list of available themes for Bash-It?

You can find a list of available themes in the themes directory of the Bash-It repository on GitHub.

How can I customize the fonts in Bash-It?

You can customize the fonts by editing the relevant configuration files, such as powerline.theme.bash and prompt.theme.bash, within the Bash-It installation directory.

Is Bash-It an open-source software?

Yes, Bash-It is an open-source project, and contributions from the community are welcomed and encouraged.

What are the steps to update to the latest commit of Bash-It?

To update to the latest commit of Bash-It, navigate to the Bash-It directory and execute a git pull command to fetch the latest changes from the repository.

How can Bash-It help with automation tasks?

Bash-It provides various functions and scripts that can assist in automating common tasks, making your terminal experience more efficient.

Conclusion

In this tutorial, we discussed how to implement a bash framework that helps us manage themes, scripts and aliases. This was largely borrowed from Oh-My-Zsh which is a similar framework for the Z Shell. These kinds of community-driven projects which take inspiration from each other are only possible in Open source which is one of the reasons why I love the open-source developer and user community of which I am a part. Have fun and keep exploring.