[clug] Command of the Hour

Kim Holburn kim.holburn at gmail.com
Sat Sep 27 11:21:14 GMT 2008


Another interesting idea I just discovered googling around, that you  
might like to add to your terminal-fu:

http://briancarper.net/2007/09/14/keeping-bash-history-in-sync-on-disk-and-between-multiple-terminals/
http://tinyurl.com/3bvymq

> Keeping bash history in sync on disk and between multiple terminals
>
> I rely on my ~/.bash_history extensively to avoid retyping things,  
> both short-term and long term (when I want to look up something I  
> typed yesterday or last week).
>
> First, an obvious necessity is
>
> shopt -s histappend
>
> in ~/.bashrc, so that bash just keeps on adding to the end of the  
> ~/.bash_history file rather than obliterate the file at regular  
> intervals.
>
> By default, bash reads from your ~/.bash_history once when you log  
> in to a terminal, and it updates ~/.bash_history once when you log  
> out. I dislike both of these default behaviors.
>
> Writing out to ~/.bash_history only when you log out is no good,  
> because what if your terminal dies unexpectedly? You'll lose the  
> history of any commands you typed there. This can happen if you kill  
> a bash process, or if the machine powers off unexpectedly, or who  
> knows what. So, to manually update your ~/.bash_history immediatety,  
> at any time you can use this:


--
Kim Holburn
IT Network & Security Consultant
Ph: +39 06 855 4294  M: +39 3494957443
mailto:kim at holburn.net  aim://kimholburn
skype://kholburn - PGP Public Key on request







More information about the linux mailing list