Skip to content

Instantly share code, notes, and snippets.

@arq5x
Created January 22, 2013 02:52
Show Gist options
  • Save arq5x/4591687 to your computer and use it in GitHub Desktop.
Save arq5x/4591687 to your computer and use it in GitHub Desktop.
Unique BASH history
HISTCONTROL="erasedups"
export HISTCONTROL
@kasperdanielhansen
Copy link

You should add
shopt -s histappend
shopt -s cmdhist
bind '"\e[B": history-search-forward'
bind '"\e[A": history-search-backward'
(on top of erasedups). This is even better. Say you type
# ls
and press UP. Then UP cycles through commands starting with ls, not all commands.

@markcerqueira
Copy link

For the lazy here is the combined power of @arq5x and @kasperdanielhansen:

shopt -s histappend
shopt -s cmdhist
bind '"\e[B": history-search-forward'
bind '"\e[A": history-search-backward'

HISTCONTROL="erasedups"

export HISTCONTROL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment