Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using the Terminal app on OS X to try and clear my command history. The entries within my $HOME/.bash_history file do not match what is returned by the history command. The echo $0 command tells me that my Terminal session is using the bash shell (-bash) so I would expect these to be the same.

Also, the history -c command only clears the history that I see in the Terminal app with the history command, it doesn't affect the contents of the $HOME/.bash_history file. Please could someone help to explain my misunderstanding?

share|improve this question
up vote 1 down vote accepted

Ok, apologies, I just realised that the command history is cached in memory until the terminal session is exited cleanly. The $HOME/.bash_history file and history command now match as expected.

share|improve this answer

Your Answer


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.