{"id":9264,"date":"2019-02-07T15:57:07","date_gmt":"2019-02-07T15:57:07","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=9264"},"modified":"2019-02-10T07:10:29","modified_gmt":"2019-02-10T07:10:29","slug":"it-bash-framework-to-control-your-scripts-and-aliases","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/02\/07\/it-bash-framework-to-control-your-scripts-and-aliases\/","title":{"rendered":"it &#8211; Bash Framework to Control Your Scripts and Aliases"},"content":{"rendered":"<p><strong>Bash-it<\/strong>\u00a0is a bundle of community Bash commands and scripts for\u00a0<strong>Bash 3.2+<\/strong>, 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.<\/p>\n<p>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\u00a0<strong>Bash-it<\/strong>\u00a0is for you! Stop polluting your\u00a0<strong>~\/bin<\/strong>\u00a0directory and\u00a0<strong>.bashrc<\/strong>\u00a0file, fork\/clone Bash-it and begin hacking away.<\/p>\n<h3>How to Install Bash-it in Linux<\/h3>\n<p>To install\u00a0<strong>Bash-it<\/strong>, first you need to clone the following repository to a location of your choice, for example:<\/p>\n<pre>$ git clone --depth=1 https:\/\/github.com\/Bash-it\/bash-it.git ~\/.bash_it\r\n<\/pre>\n<p>Then run the following command to install\u00a0<strong>Bash-it<\/strong>\u00a0(it automatically backup your\u00a0<strong>~\/.bash_profile<\/strong>\u00a0or\u00a0<strong>~\/.bashrc<\/strong>, depending on your OS). You will be asked \u201c<strong>Would you like to keep your .bashrc and append bash-it templates at the end? [y\/N]<\/strong>\u201d, answer according to your preference.<\/p>\n<pre>$ ~\/.bash_it\/install.sh \r\n<\/pre>\n<div id=\"attachment_31789\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/install-bash-it.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31789\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/install-bash-it.png\" sizes=\"auto, (max-width: 952px) 100vw, 952px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/install-bash-it.png 952w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/install-bash-it-768x538.png 768w\" alt=\"Install Bash-It in Linux\" width=\"952\" height=\"667\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Install Bash-It in Linux<\/p>\n<p>After installation, you can use\u00a0<a href=\"https:\/\/www.tecmint.com\/tag\/linux-ls-command\/\" target=\"_blank\" rel=\"noopener\">ls command<\/a>\u00a0to verify the\u00a0<strong>bash-it<\/strong>\u00a0installation files and directories as shown.<\/p>\n<pre>$ ls .bash_it\/\r\n<\/pre>\n<div id=\"attachment_31792\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/bash-it-installation-directory.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31792\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/bash-it-installation-directory.png\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/bash-it-installation-directory.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/bash-it-installation-directory-768x93.png 768w\" alt=\"Verify Bash-It Installation\" width=\"802\" height=\"97\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Verify Bash-It Installation<\/p>\n<\/div>\n<p>To start using\u00a0<strong>Bash-it<\/strong>, open a new tab or run:<\/p>\n<pre>$ source $HOME\/.bashrc\r\n<\/pre>\n<h3>How to Customize Bash-it in Linux<\/h3>\n<p>To customize\u00a0<strong>Bash-it<\/strong>, you need to edit your modified\u00a0<strong>~\/.bashrc<\/strong>\u00a0shell 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:<\/p>\n<pre>  \r\n$ bash-it show aliases        \t\r\n$ bash-it show completions  \r\n$ bash-it show plugins        \t\r\n<\/pre>\n<p>Next, we will demonstrate how to enable aliases, but before that, first list the current aliases with the following command.<\/p>\n<pre>$ alias \r\n<\/pre>\n<div id=\"attachment_31793\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/view-current-aliases.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31793\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/view-current-aliases.png\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/view-current-aliases.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/view-current-aliases-768x366.png 768w\" alt=\"View Current Aliases in Linux\" width=\"802\" height=\"382\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">View Current Aliases in Linux<\/p>\n<\/div>\n<p>All the aliases are located in the\u00a0<strong>$HOME\/.bash_it\/aliases\/<\/strong>\u00a0directory. Now let\u2019s enable the\u00a0<a href=\"https:\/\/www.tecmint.com\/apt-advanced-package-command-examples-in-ubuntu\/\" target=\"_blank\" rel=\"noopener\">apt<\/a>\u00a0aliases as shown.<\/p>\n<pre>$ bash-it enable alias apt\r\n<\/pre>\n<div id=\"attachment_31794\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/enable-an-alias.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31794\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/enable-an-alias.png\" alt=\"Enable Alias in Linux\" width=\"602\" height=\"116\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Enable Alias in Linux<\/p>\n<\/div>\n<p>Then reload\u00a0<strong>bash-it<\/strong>\u00a0configs and check the current aliases once more.<\/p>\n<pre>$ bash-it reload\t\r\n$ alias\r\n<\/pre>\n<p>From the output of the\u00a0<a href=\"https:\/\/www.tecmint.com\/create-alias-in-linux\/\" target=\"_blank\" rel=\"noopener\">alias command<\/a>, the\u00a0<strong>apt aliases<\/strong>\u00a0are now enabled.<\/p>\n<div id=\"attachment_31795\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/reload-bash-it-and-check-current-aliases.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31795\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/reload-bash-it-and-check-current-aliases.png\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/reload-bash-it-and-check-current-aliases.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/reload-bash-it-and-check-current-aliases-768x475.png 768w\" alt=\"Check Current Aliases in Linux\" width=\"802\" height=\"496\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Check Current Aliases in Linux<\/p>\n<\/div>\n<p>You can disable newly enabled alias with the following commands.<\/p>\n<pre>$ bash-it disable alias apt\r\n$ bash-it reload\r\n<\/pre>\n<div id=\"attachment_31796\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/disable-apt-aliases.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31796\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/disable-apt-aliases.png\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/disable-apt-aliases.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/disable-apt-aliases-768x147.png 768w\" alt=\"Disable Aliases in Linux\" width=\"802\" height=\"154\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Disable Aliases in Linux<\/p>\n<\/div>\n<p>In the next section, we will use similar steps to enable or disable completions (<strong>$HOME\/.bash_it\/completion\/<\/strong>) and plugins (<strong>$HOME\/..bash_it\/plugins\/<\/strong>). All enabled features are located in the\u00a0<strong>$HOME\/.bash_it\/enabled<\/strong>directory.<\/p>\n<h3>How to Manage Bash-it Theme<\/h3>\n<p>The default theme for\u00a0<strong>bash-it<\/strong>\u00a0is\u00a0<strong>bobby<\/strong>; you can check this using the\u00a0<strong>BASH_IT_THEME env<\/strong>\u00a0variable as shown.<\/p>\n<pre>echo $BASH_IT_THEME\r\n<\/pre>\n<div id=\"attachment_31797\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/check-default-theme.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31797\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/check-default-theme.png\" alt=\"Check Bash-it Theme\" width=\"602\" height=\"116\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Check Bash-it Theme<\/p>\n<\/div>\n<p>You can find over\u00a0<strong>50+ Bash-it<\/strong>\u00a0themes in the\u00a0<strong>$BASH_IT\/themes<\/strong>\u00a0directory.<\/p>\n<pre>$ ls $BASH_IT\/themes\r\n<\/pre>\n<div id=\"attachment_31798\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/view-bash-it-themes.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31798\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/view-bash-it-themes.png\" alt=\"View Bash-It Themes\" width=\"602\" height=\"781\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">View Bash-It Themes<\/p>\n<\/div>\n<p>To preview all the themes in your shell before using any, run the following command.<\/p>\n<pre>$ BASH_PREVIEW=true bash-it reload\r\n<\/pre>\n<div id=\"attachment_31799\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/preview-all-bash-it-themes.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31799\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/preview-all-bash-it-themes.png\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/preview-all-bash-it-themes.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/preview-all-bash-it-themes-768x839.png 768w\" alt=\"Preview All Bash-It Themes\" width=\"802\" height=\"876\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Preview All Bash-It Themes<\/p>\n<\/div>\n<p>Once you have identified a theme to use, open your\u00a0<strong>.bashrc<\/strong>\u00a0file and find the following line in it and change it value to the name of the theme you want, for example:<\/p>\n<pre>$ export BASH_IT_THEME='essential'\r\n<\/pre>\n<div id=\"attachment_31800\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/change-bash-it-theme.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31800\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/change-bash-it-theme.png\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/change-bash-it-theme.png 772w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/change-bash-it-theme-768x342.png 768w\" alt=\"Change Bash-It Theme\" width=\"772\" height=\"344\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Change Bash-It Theme<\/p>\n<\/div>\n<p>Save the file and close, and source it as shown before.<\/p>\n<pre>$ source $HOME\/.bashrc\r\n<\/pre>\n<p><strong>Note<\/strong>: In case you have built a your own custom themes outside of\u00a0<strong>$BASH_IT\/themes<\/strong>\u00a0directory, point the\u00a0<strong>BASH_IT_THEME<\/strong>\u00a0variable directly to the theme file:<\/p>\n<pre>export BASH_IT_THEME='\/path\/to\/your\/custom\/theme\/'\r\n<\/pre>\n<p>And to disable theming, leave the above env variable empty.<\/p>\n<pre>export BASH_IT_THEME=''\r\n<\/pre>\n<h3>How to Search Plugins, Aliases or Completions<\/h3>\n<p>You can easily check out which of the plugins, aliases or completions are available for a specific programming language, framework or an environment.<\/p>\n<p>The trick is simple: just search for multiple terms related to some of the commands you use frequently, for example:<\/p>\n<pre>$ bash-it search python pip pip3 pipenv\r\n$ bash-it search git\r\n<\/pre>\n<div id=\"attachment_31801\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/search-in-bash-it.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31801\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/02\/search-in-bash-it.png\" alt=\"Search in Bash-It\" width=\"662\" height=\"211\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Search in Bash-It<\/p>\n<\/div>\n<p>To view help messages for the aliases, completions and plugins, run:<\/p>\n<pre>$ bash-it help aliases        \t\r\n$ bash-it help completions\r\n$ bash-it help plugins<\/pre>\n<\/div>\n<p>You can create you own custom scripts, and aliases, in the following files in the respective directories:<\/p>\n<pre>aliases\/custom.aliases.bash \r\ncompletion\/custom.completion.bash \r\nlib\/custom.bash \r\nplugins\/custom.plugins.bash \r\ncustom\/themes\/\/&lt;custom theme name&gt;.theme.bash \r\n<\/pre>\n<h3>Updating and Uninstalling Bash-It<\/h3>\n<p>To update Bash-it to the latest version, simply run:<\/p>\n<pre>$ bash-it update\r\n<\/pre>\n<p>If you don\u2019t like Bash-it anymore, you can uninstall it by running the following commands.<\/p>\n<pre>$ cd $BASH_IT\r\n$ .\/uninstall.sh\r\n<\/pre>\n<p>The\u00a0<strong>uninstall.sh<\/strong>\u00a0script 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.<\/p>\n<pre>$ rm -rf $BASH_IT  \r\n<\/pre>\n<p>And remember to start a new shell for the recent changes to work or source it again as shown.<\/p>\n<pre>$ source $HOME\/.bashrc\r\n<\/pre>\n<p>You can see all usage options by running:<\/p>\n<pre>$ bash-it help\r\n<\/pre>\n<p>Finally,\u00a0<strong>Bash-it<\/strong>\u00a0comes with a number of cool features related to\u00a0<strong>Git<\/strong>.<\/p>\n<p>For more information, see the Bash-it Github repository:\u00a0<a href=\"https:\/\/github.com\/Bash-it\/bash-it\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/github.com\/Bash-it\/bash-it<\/a>.<\/p>\n<p>That\u2019s all!\u00a0<strong>Bash-it<\/strong>\u00a0is an easy and productive way to keep all your bash scripts and aliases under control.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/bash-it-control-shell-scripts-aliases-in-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bash-it\u00a0is a bundle of community Bash commands and scripts for\u00a0Bash 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 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/02\/07\/it-bash-framework-to-control-your-scripts-and-aliases\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;it &#8211; Bash Framework to Control Your Scripts and Aliases&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-9264","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/9264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=9264"}],"version-history":[{"count":2,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/9264\/revisions"}],"predecessor-version":[{"id":9498,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/9264\/revisions\/9498"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=9264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=9264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=9264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}