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.

My bash shell is clearing its history automatically and I am unable to figure out whats wrong.

I have looked at the bashrc file and these are the settings


Can some one suggest what exactly is going wrong?

share|improve this question

migrated from stackoverflow.com Sep 14 '12 at 8:14

This question came from our site for professional and enthusiast programmers.

When is bash shell clearing its history automatically? On logout? –  Lex Sep 14 '12 at 6:09

3 Answers 3

It's can be rewrited by different sessions
Try to add it:

  shopt -s histappend
  PROMPT_COMMAND='history -a'
share|improve this answer

Your ~/.bash_history may not be writable

share|improve this answer
It has permissions set to read and write. I dont think thats the issue –  user1670541 Sep 14 '12 at 6:06

It's can be this line in bash init files:


Or this variable is undefined.

Or in file bash_logout maybe remove the history-file.

See also: http://searchenterpriselinux.techtarget.com/tip/Shell-game-Managing-Bash-command-history

share|improve this answer

Your Answer


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