DEV Community

Cover image for Fix and Recover a "corrupt history file" in ZSH
Musale Martin
Musale Martin

Posted on

3 1

Fix and Recover a "corrupt history file" in ZSH

Move to the 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

Finally, reload the history.

$ fc -R .zsh_history

Happy ZSH-ing!

Top comments (0)

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay