[colug-432] Search Command History

Scott McCarty scott.mccarty at gmail.com
Tue Feb 11 09:02:47 EST 2014


That is exactly what I do too. I also increase the history log to 500000 so that I don't loose history. It might have been crazy when we had 2MB disks, but now it's very low cost to store ALL history.

Best Regards
Scott M

----- Original Message -----
> From: "Eric Floehr" <eric at intellovations.com>
> To: "Central OH Linux User Group - 432xx" <colug-432 at colug.net>
> Sent: Tuesday, February 11, 2014 8:59:33 AM
> Subject: Re: [colug-432] Search Command History
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Is there something I’m missing that will cause this to get written
> more immediately than on a proper logout? I’ve run into several
> situations where I really needed to see that history to know what
> someone else was doing, or where I left off, or what that complex
> sed command was - but I’m out of luck.
> 
> 
> 
> Yes, put this in your .bashrc:
> 
> 
> 
> PROMPT_COMMAND="${PROMPT_COMMAND:-:} ; history -a; history -n"
> 
> 
> At every prompt it will append to the history file commands run since
> the last time it was appended.
> 
> 
> The second, history -n, is optional... it will reread the history
> file.
> 
> 
> Note that multiple shells will have their history intermingled, so
> you do run into a few problems up-arrowing and not always seeing a
> coherent past. I've removed history -n for that reason on my shells.
> 
> 
> Also, you might find histappend needs set (put this also in your
> .bashrc):
> 
> 
> shopt -s histappend
> 
> 
> -Eric
> 
> 
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432
> 



More information about the colug-432 mailing list