Skip to content

Instantly share code, notes, and snippets.

@1eedaegon
Last active September 24, 2021 04:29
Show Gist options
  • Save 1eedaegon/c2152c0b0e544ac84b15343cada2f84a to your computer and use it in GitHub Desktop.
Save 1eedaegon/c2152c0b0e544ac84b15343cada2f84a to your computer and use it in GitHub Desktop.
How to recover corrupted zsh_history
# 0. Move home directory
$ cd ~
# 1. Rename corrupted zsh_history
$ mv .zsh_history .zsh_history_bad
# 2. Encoding zsh_history_bad
$ strings -eS .zsh_history_bad > .zsh_history
# 3. Read history from file
$ fc -R .zsh_history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment