How to fix a corrupt (zsh) history file

Posted . Visible to the public.

When you the following error:

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

You can try and fix your history file by extracting only the valid strings:

cd ~
mv .zsh_history .zsh_history_bad
strings .zsh_history_bad > .zsh_history

fc -R .zsh_history # reloads the history
Last edit
Andreas Robecke
License
Source code in this card is licensed under the MIT License.
Posted to makandra dev (2015-07-28 06:57)