Rocking the blogosphere
Apple Online Store

Don’t lose history in bash

I don’t think I’ve relied too heavily on bash’s history feature in the past, because often what I needed to recall wasn’t there. The reason why is that if you have multiple bash shells, by default each one rewrites the entire .bash_history file when it exits, which means that you keep losing stuff. It turns out that there is a very easy way to fix this - add these lines to your bash startup files:


shopt -s histappend
PROMPT_COMMAND=’history -a’

I have no idea why this is not the default behavior!

This and other bash tips here

Del.icio.us Digg Reddit Technorati

Possibly related posts

No comments yet. Be the first.

Leave a reply

Apple Online Store
Apple Online Store