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.

Facebook Comments

More Stuff

How to Compare Local and Remote Files in Linux In this article, we will show how to compare or find the difference between local and remote files in Linux. In a recent post, we reviewed 9 best file...
HTTP Prompt – An Interactive Command Line HTTP Client HTTP Prompt (or HTTP-prompt) is an interactive command-line HTTP client built on HTTPie and prompt_toolkit, featuring autocomplete and syntax highligh...
How to Calculate IP Subnet Address with ipcalc Tool When managing a network, you will undoubtedly need to deal with subnetting. Some network administrators are able to do the binary math quite quickly i...
How to Find Out Who is Using a File in Linux In this article, we will explain how to find out who is using a particular file in Linux. This will help you know the system user or process that is u...
Spread the love

Posted by News Monkey