Skip to content

Instantly share code, notes, and snippets.

@tsq
Forked from kolach/fix_zsh_history.sh
Created May 3, 2018 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsq/326b6d0fd4421f1463449901d431fbba to your computer and use it in GitHub Desktop.
Save tsq/326b6d0fd4421f1463449901d431fbba to your computer and use it in GitHub Desktop.
Fix for zsh: corrupt history file /home/marc/.zsh_history
#!/bin/sh
# Borrowed from http://marcparadise.com/blog/2013/09/21/how-to-fix-a-corrupt-history-file/
# If you ever see a message like this upon starting a new shell
# zsh: corrupt history file /home/marc/.zsh_history
# here is a quick fix
cd ~
mv .zsh_history .zsh_history_bad
strings .zsh_history_bad > .zsh_history
# And reload history
fc -R .zsh_history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment