# move to home directory
cd ~
# 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 .zsh_history_bad > .zsh_history
# reload the history
fc -R .zsh_historyIf you found this helpful, don't hesitate to buymeacoffee
Thanks!
You can also check the env var
HISTFILEto see if the user has changed the default history file location.Slightly less readable but more portable