Bash-it – Bash Framework to Control Your Scripts and Aliases

Bash-it is a bundle of community Bash commands and scripts for Bash 3.2+, which comes with autocompletion, themes, aliases, custom functions, and more. It offers a useful framework for developing, maintaining and using shell scripts and custom commands for your daily work.

If you are using the Bash shell on a daily basis and looking for an easy way to keep track of all your scripts, aliases and functions, then Bash-it is for you! Stop polluting your ~/bin directory and .bashrc file, fork/clone Bash-it and begin hacking away.

How to Install Bash-it in Linux

To install Bash-it, first you need to clone the following repository to a location of your choice, for example:

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

Then run the following command to install Bash-it (it automatically backup your ~/.bash_profile or ~/.bashrc, depending on your OS). You will be asked “Would you like to keep your .bashrc and append bash-it templates at the end? [y/N]”, answer according to your preference.

$ ~/.bash_it/install.sh 
Install Bash-It in Linux
Install Bash-It in Linux

After installation, you can use ls command to verify the bash-it installation files and directories as shown.

$ ls .bash_it/
Verify Bash-It Installation
Verify Bash-It Installation

To start using Bash-it, open a new tab or run:

$ source $HOME/.bashrc

How to Customize Bash-it in Linux

To customize Bash-it, you need to edit your modified ~/.bashrc shell startup file. To list all installed and available aliases, completions, and plugins run the following commands, which should also shows you how to enable or disable them:

  
$ bash-it show aliases        	
$ bash-it show completions  
$ bash-it show plugins        	

Next, we will demonstrate how to enable aliases, but before that, first list the current aliases with the following command.

$ alias 
View Current Aliases in Linux
View Current Aliases in Linux

All the aliases are located in the $HOME/.bash_it/aliases/ directory. Now let’s enable the apt aliases as shown.

$ bash-it enable alias apt
Enable Alias in Linux
Enable Alias in Linux

Then reload bash-it configs and check the current aliases once more.

$ bash-it reload	
$ alias

From the output of the alias command, the apt aliases are now enabled.

Check Current Aliases in Linux
Check Current Aliases in Linux

You can disable newly enabled alias with the following commands.

$ bash-it disable alias apt
$ bash-it reload
Disable Aliases in Linux
Disable Aliases in Linux

In the next section, we will use similar steps to enable or disable completions ($HOME/.bash_it/completion/) and plugins ($HOME/..bash_it/plugins/). All enabled features are located in the $HOME/.bash_it/enabled directory.

How to Manage Bash-it Theme

The default theme for bash-it is bobby; you can check this using the BASH_IT_THEME env variable as shown.

echo $BASH_IT_THEME
Check Bash-it Theme
Check Bash-it Theme

You can find over 50+ Bash-it themes in the $BASH_IT/themes directory.

$ ls $BASH_IT/themes
View Bash-It Themes
View Bash-It Themes

To preview all the themes in your shell before using any, run the following command.

$ BASH_PREVIEW=true bash-it reload
Preview All Bash-It Themes
Preview All Bash-It Themes

Once you have identified a theme to use, open your .bashrc file and find the following line in it and change it value to the name of the theme you want, for example:

$ export BASH_IT_THEME='essential'
Change Bash-It Theme
Change Bash-It Theme

Save the file and close, and source it as shown before.

$ source $HOME/.bashrc

Note: In case you have built a your own custom themes outside of $BASH_IT/themes directory, point the BASH_IT_THEME variable directly to the theme file:

export BASH_IT_THEME='/path/to/your/custom/theme/'

And to disable theming, leave the above env variable empty.

export BASH_IT_THEME=''

How to Search Plugins, Aliases or Completions

You can easily check out which of the plugins, aliases or completions are available for a specific programming language, framework or an environment.

The trick is simple: just search for multiple terms related to some of the commands you use frequently, for example:

$ bash-it search python pip pip3 pipenv
$ bash-it search git
Search in Bash-It
Search in Bash-It

To view help messages for the aliases, completions and plugins, run:

$ bash-it help aliases        	
$ bash-it help completions
$ bash-it help plugins     

You can create you own custom scripts, and aliases, in the following files in the respective directories:

aliases/custom.aliases.bash 
completion/custom.completion.bash 
lib/custom.bash 
plugins/custom.plugins.bash 
custom/themes//<custom theme name>.theme.bash 

Updating and Uninstalling Bash-It

To update Bash-it to the latest version, simply run:

$ bash-it update

If you don’t like Bash-it anymore, you can uninstall it by running the following commands.

$ cd $BASH_IT
$ ./uninstall.sh

The uninstall.sh script will restore your previous Bash startup file. Once it has completed the operation, you need to remove the Bash-it directory from your machine by running.

$ rm -rf $BASH_IT  

And remember to start a new shell for the recent changes to work or source it again as shown.

$ source $HOME/.bashrc

You can see all usage options by running:

$ bash-it help

Finally, Bash-it comes with a number of cool features related to Git.

For more information, see the Bash-it Github repository: https://github.com/Bash-it/bash-it.

That’s all! Bash-it is an easy and productive way to keep all your bash scripts and aliases under control. If you have any questions to ask, use the feedback form below.

If you read this far, tweet to the author to show them you care. Tweet a thanks
Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

1 thought on “Bash-it – Bash Framework to Control Your Scripts and Aliases”

  1. “append bash-it templates at the end” What are bash-it templates?

    “In the next section, we will use similar steps to enable or disable completions ”

    That section does not exist. Unless you mean that the procedure to enable/disable completions is the same as for enabling/disabling aliases. If that is true then you should have so, not talk about a no-existent “next section”.

    Reply

Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.