Brief: Bash-it is a community driven Bash framework for maintaining various shell scripts, custom commands, aliases & more and make you terminal look & act way cooler.
We all use the terminal, more or less, regardless of which Linux distribution we use. But have you ever thought the default appearance to be a little mundane? Or ever wished for having a bit more control over your terminal workflow? Today I’m going to show you the way to crank up your terminal experience.
Note: This article is intended for at least intermediate level Linux users who would know their way around Shell and its configuration. Beginners may try it at their own risk.
[irp posts = “8902” ]
What’s Underneath the Terminal?
The terminal or terminal emulator is just an interface for interacting with the shell. Now, in simple words, shell (or command-line interpreter) is a program that we use to interact the underlying system by entering commands.
There are many different shells for Linux. But, most of the popular Linux distributions come with Bash as their default shell. So, odds are really high that you are using Bash in your terminal.
For checking if you are using Bash, run the following command and see if you see YES:
[ -n "$(echo $BASH)" ] && echo YES || echo NO
Now that you know if you are using Bash, let’s dive into the main topic.
Bash-it is a Bash framework for using, developing and maintaining various shell scripts, custom commands, aliases and more. It is a community driven project on GitHub. So, everything you find in it is used & tested by thousands of people and developed by many contributors.
Bash-it comes with a huge collection of aliases used by the community. Currently, 32 alias scripts are available. You can enable/disable them by:
bash-it enable alias apt bash-it disable alias git
Typing the whole command every single time is painful. Most of the command-line tools on Linux enables completion while installing them. So, that if you write first two or three letters on the terminal and hit TAB, it is auto-completed.
But not all of them have it enabled. For many command-line tools, the completion scripts are written by the community developers rather than the official source.
Bash-it has a collection of those and it gives you an easy way for enabling/disabling them:
bash-it enable completion ssh bash-it disable completion pip
You should enable system completion for loading completion scripts provided by the system and bash-it for bash-it command completion.
[irp posts = “8820” ]
Bash-it comes with a bunch of plugins for various tools and purposes. Currently, there is 60 plugins available. Generally plugins may contain:
- Helper functions for performing various complex tasks easily. E.g.: extract, git, rails, ssh etc.
- Initialization & configuration scripts that prepare tools to be ready to use. E.g.: fasd, go, node, nvm, rbenv etc.
- Dependencies for other parts of bash-it. E.g.: alias-completion, base, battery etc.
The alias-completion plugin is needed to be enabled for the completion scripts to work properly. Also, you should enable the base plugin as some other plugins depend on it. The commands for enabling/disabling plugins are similar to what we saw before.
This is the cool part. Bash-it currently has 57 themes for you Bash prompt. Here’s how the Ubuntu vanilla Bash prompt looks like:
And this is how it looks like with Bash-it theme:
Bash-it themes can show various useful information in your prompt, like:
- Git repository and other version control system information
- Python and Ruby version
- Time, battery information and so on!
Cool, isn’t it? For setting a theme, you have to set the value of BASH_IT_THEME variable in your “.bashrc” file like this:
Custom Scripts & Themes
If you want to load your own custom scripts with Bash-it, simply put the scripts in the “./custom/” directory inside bash-it folder. Bash-it will load every file that ends with “.bash” in their filename.
As for custom themes, you theme folder should go into “./custom/themes/” directory.
Again, Bash-it is a community driven project, so if you think you scripts will be useful to the community you can consider contributing them to the main project on GitHub. That’s how it will keep growing better.
Now, let’s see how to install Bash-it.
[irp posts = “12113” ]
The simplest way of installing Bash-it is running the following commands:
git clone --depth=1 https://github.com/Bash-it/bash-it ~/.bash-it cd ~/.bash-it ./install.sh
Bash-it can be used and installed in various fashion. For example:
- Simply use the cloned repository (shown above).
- Fork it on GitHub, clone it and modify it as you see fit.
- Use it with a dotfiles manager, like – dotbot (that’s a discussion for another day).
You have to experiment with it to see how you feel comfortable.
For additional information, you can check the README file & Wiki. Even their GitHub page has plenty of information and instructions on using it.
Is it worth trying?
You are kidding, right? Of course, it is. It might take you a while to figure out the workflow with Bash-it. But, in the long run, it helps a lot.
Are you going to give it a try? Have you tried Bash-it before? Share your thoughts with us.