Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

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.