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
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.
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'
Here you can change ‘bobby’ to any theme present in your themes folder. I personally really like the ‘Wanelo’ theme.
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.
The aliases are available in $BASH_IT/aliases/available.
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
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.
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.
This can be done to load any alias or script in Bash_IT.
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.