Make a better BASH config

Author:Brant C. Faircloth
Copyright:This documentation is available under a Creative Commons (CC-BY) license.

Our HPC systems use BASH (without the option of installing ZSH). This is a bit of a bummer, but you can also make BASH more ZSH-like with a few changes.

Steps

  1. Downloand and install bash-it from github
  1. Because we use conda environments on the HPC, in ~/.bashrc set

    export BASH_IT_THEME='bobby-python'
    
  2. While you are there, you may also want to add the following, which will give you prettier colors for``ls``:

    eval "$(dircolors)"
    
  3. And, finally, for ~/.bashrc, you may want your history to log more information and also to include time and date stamps. You can do that by adding the following, which gives you a time stamp for all commands, ingnores duplicates, records lots of history lines, and immediately appends those lines to your history, rather than doing so when you log out (the standard behavior):

    # set my history preferences
    export HISTTIMEFORMAT="%m/%d/%y %T "
    export HISTCONTROL=ignoredups
    export HISTFILESIZE=1000000
    export HISTSIZE=1000000
    export PROMPT_COMMAND='history -a'
    
  4. Create ~/.inputrc with the following contents - these changes let you use an anchor term and the up arrow to search backwards in history. For example, if you type cd and hit the up arrow, you will search backwards in your history for all commands that start with cd.

    "\e[A": history-search-backward
    "\e[B": history-search-forward
    
    set show-all-if-ambiguous on
    set completion-ignore-case on