{"slug": "how-to-fix-and-recover-a-corrupt-history-file-in-zsh", "title": "How to fix and recover a “corrupt history file” in zsh", "summary": "The article provides a step-by-step method to fix a corrupt history file in the zsh shell. It instructs users to rename the existing `.zsh_history` file, extract printable strings from the corrupted file into a new one, and then reload the history using the `fc -R` command. The guide also includes a prompt to support the author via a \"buymeacoffee\" link.", "body_md": "# move to home directory\ncd ~\n# move the .zsh_history file into another .zsh_history_bad file\nmv .zsh_history .zsh_history_bad\n# write all printable strings into a new .zsh_history file\nstrings .zsh_history_bad > .zsh_history\n# reload the history\nfc -R .zsh_history\nIf you found this helpful, don't hesitate to buymeacoffee", "url": "https://wpnews.pro/news/how-to-fix-and-recover-a-corrupt-history-file-in-zsh", "canonical_source": "https://gist.github.com/musale/751cfb132fe6ad05d3a5cc306d72465c", "published_at": "2017-02-23 07:47:59+00:00", "updated_at": "2026-05-23 22:05:40.458523+00:00", "lang": "en", "topics": ["developer-tools"], "entities": [], "alternates": {"html": "https://wpnews.pro/news/how-to-fix-and-recover-a-corrupt-history-file-in-zsh", "markdown": "https://wpnews.pro/news/how-to-fix-and-recover-a-corrupt-history-file-in-zsh.md", "text": "https://wpnews.pro/news/how-to-fix-and-recover-a-corrupt-history-file-in-zsh.txt", "jsonld": "https://wpnews.pro/news/how-to-fix-and-recover-a-corrupt-history-file-in-zsh.jsonld"}}