How to fix corrupt history file .zsh_history?

· · 11710 views

On open terminal, I am getting this error:

zsh: corrupt history file /home/harish/.zsh_history

This is not allowing search back through the history with CTRL+R and editing previous commands with fc. How can I fix this error?

0
1 Answer

Run the following commands to fix the error and recover history to a new file:

cd ~
mv .zsh_history .zsh_history_old
strings .zsh_history_old > .zsh_history
fc -R .zsh_history
0

Please login or create new account to participate in this conversation.