Last active
September 15, 2021 21:56
-
-
Save Sp0ne/91623d7185f6e7efa7590979b833734f to your computer and use it in GitHub Desktop.
Fixes a corrupt .zsh_history file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# -- | |
# Vinces - https://vinces.io | |
# -- | |
# Fixes a corrupt .zsh_history file: | |
# ➜ cd Folder && zsh fix-corrupt-zsh-history.sh | |
# 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 -eS ~/.zsh_history_bad > ~/.zsh_history | |
# reload the history | |
fc -R ~/.zsh_history | |
# remove bad history backup | |
rm ~/.zsh_history_bad |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment