I use Z shell or zsh in my computer. A few days ago i get error “corrupt history file”, so how to fix it, follow this step:
move to home directory
cd ~
move the .zsh_history file into another .zsh_history_old file
mv .zsh_history .zsh_history_old
write all printable strings into a new .zsh_history file
strings .zsh_history_old > .zsh_history
reload the history
fc -R .zsh_history
Top comments (0)