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.
After installation, you can use ls command to verify the bash-it installation files and directories as shown.
$ ls .bash_it/
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.
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
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.
You can disable newly enabled alias with the following commands.
$ bash-it disable alias apt $ bash-it reload
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.
You can find over 50+ Bash-it themes in the $BASH_IT/themes directory.
$ ls $BASH_IT/themes
To preview all the themes in your shell before using any, run the following command.
$ BASH_PREVIEW=true bash-it reload
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'
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:
And to disable theming, leave the above env variable empty.
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
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//.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.