[clug] Command of the Hour

Alex Satrapa grail at goldweb.com.au
Thu Nov 6 05:14:24 GMT 2008


On 27/09/2008, at 21:21 , Kim Holburn wrote:

> 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).

For ZSH, I've been using this in the ~/.zshrc file for years:

setopt HIST_IGNORE_ALL_DUPS
setopt HIST_VERIFY
setopt HIST_NO_STORE
setopt SHARE_HISTORY
setopt APPEND_HISTORY

This shares the history file amongst all Z shells, appends commands to  
the history, removes duplicates of that command from the history, and  
loads the history line retrieved by eg !54 into the command line for  
you to edit before you execute the command.

ZSH will always remember the 1 previous instruction executed from  
"this" shell. As you continue to scroll back through the history,  
you'll end up in the global history.

Enjoy :)
(sorry for the thread necro, I've been overrun with email for a a bit  
and only found these on the cutting room floor this morning)



More information about the linux mailing list