Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have bash set up to save history, to a file. It does this whenever bash exits [properly]. As sometimes bash does not exit properly the history is lost.

So the question is can I set up bash to save history more regularly?


I am running Debian Gnu (version 6, Squeeze) with a Linux kernel.

bash version: GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)

share|improve this question

1 Answer 1

up vote 2 down vote accepted

save this to your bash_profile or bashrc

shopt -s histappend

PROMPT_COMMAND="history -a;$PROMPT_COMMAND"

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.