After upgrading to OS X El Capitan (at least I noticed after update), in bash, history -c
command does not work as usual.
History clearing only works for current tab. After opening another tab, it is possible to access history.
I know it is possibly to remove .bash_history
file but actually I am curious about this new behaviour?
Maybe it is related to new .bash_sessions
feature. Is there any way to use history -c
as usual (clearing history across every bash instances)?
Thanks.
On OS X, the shell variable HISTFILE doesn't seem to point to ~/.bash_history. Instead, it points to some sort of temp file like:
/Users/$LOGNAME/.bash_sessions/7F058D96-4161-4F7C-B9F7-CFFEB43C35B2.historynew
As a result, history -c; history -w
clears the current history buffer, but doesn't actually clear the on-disk history file. It's unclear to me how/when the HISTFILE is written to ~/.bash_history, so you may need to clear the file manually. For example:
history -c; history -w; rm ~/.bash_history
I used:
cat /dev/null > ~/.bash_history && history -c
I used this topic, maybe you could find more info there?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With