Twitter Updates

Thursday, 23 October 2008

.bashrc history tips

Some usefiul lines in my .bashrc

#Reload Bashrc
alias reload='source ~/.bashrc'

#Save history correctly when using multiple terminals
# Dont save duplicate lines or blank lines in to history
export HISTCONTROL=ignoreboth
export HISTSIZE=1000
#Append changes to history instead of overwrite full file
alias exit='history -a && exit'

An alternative to the line above is
# make it append, rather than overwrite the history
shopt -s histappend
Advantages of the alias exit it will group the output of each terminal in the history file, rather than a all terminals adding there input on the fly.