Skip to main content
Fix a corrupt zsh history file

Fix a corrupt zsh history file

·69 words·1 min·
Table of Contents
Photo by Aditya Vyas on Unsplash
If you encounter a corrupt zsh history file, it can lead to errors when starting the shell. This guide provides a simple method to recover and fix your zsh history file.

Symptom
#

When starting zsh, an error occurs:

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

How to fix it
#

cd ~
mv .zsh_history .zsh_history_bad
strings .zsh_history_bad > .zsh_history
fc -R .zsh_history
rm ~/.zsh_history_bad