1. 3
  1.  

  2. 4

    I add these two lines to my ~/.inputrc configuration file. It allows for completely integrated reverse incremental search.

    "\e[B": history-search-forward
    "\e[A": history-search-backward
    

    For instance $ ssh<up arrow key> will show the most recent ssh command, another <up arrow key> will show the next most recent. I find this to be the number one productivity boosting change to bash. Learning pushd and popd are also good.

    And don’t forget cd - for jumping to your previous directory.

    1. 4

      Just to be clear; this is readline configuration and not bash. Configuration options set in inputrc affect all shells linked to readline (eg, mysql and bash).

      http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC9

      1. 3

        I hadn’t ever bothered finding out exactly what it was affecting. I haven’t encountered any negative side affects, but I don’t do a lot of work with mysql, or really other similar shells. Hmm… I’ll have to keep it in mind! Thanks.

    2. 2

      or if you are a vim user:

      set -o vi
      

      i’m always shocked when working with an emacs hater who doesn’t set their line edit mode to vi!

      1. 2

        The docs are pretty good too: https://www.gnu.org/software/bash/manual/html_node/Using-History-Interactively.html#Using-History-Interactively

        And here is a better quick reference; which includes pdf cheatsheets (though it does blur the lines between readline and bash): http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/

        1. 1

          I changed the title to be more descriptive, if it wasn’t necessary please let me know ;)