Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unique BASH history
HISTCONTROL="erasedups"
export HISTCONTROL
@kasperdanielhansen

This comment has been minimized.

Copy link

@kasperdanielhansen kasperdanielhansen commented Sep 2, 2015

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

This comment has been minimized.

Copy link

@markcerqueira markcerqueira commented Sep 9, 2015

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