# How to fix and recover a “corrupt history file” in zsh

> Source: <https://gist.github.com/musale/751cfb132fe6ad05d3a5cc306d72465c>
> Published: 2017-02-23 07:47:59+00:00

# move to home directory
cd ~
# move the .zsh_history file into another .zsh_history_bad file
mv .zsh_history .zsh_history_bad
# write all printable strings into a new .zsh_history file
strings .zsh_history_bad > .zsh_history
# reload the history
fc -R .zsh_history
If you found this helpful, don't hesitate to buymeacoffee
