2

I removed command lines in my .bash_history. The problem is that when I execute the history command the deleted commands are still listed.

How do I load the changes ?

I tried source .bashrc and source .bash_profile without success.

I'm trying to master the bash one baby step at a time so apologies if not a good question.

1 Answer 1

2

When you are finished editing your .bash_history you need to restart your bash session - and depending if everything you are trying to hide/remove was done in that or earlier sessions you may need to get rid of those as well.

My understanding is that BASH holds its history in memory and writes it to disk on exit. Thus you need to exit bash in such a way that it does not write the history from memory back to disk. To do this issue the command "kill $$" from the command line which tells BASH to kill the current process which is itself ! This bypasses the writing of the history file to disk.

1
  • 1
    Thanks! It's working as expected now. The only small detail is that I used kill -9 $$ Commented Jun 3, 2015 at 20:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .