RC Logr 20200730 113444
Thursday, 30 Jul, 2020
If you make a mistake and enter sensitive information in your zsh prompt, it is saved in history. Since you do not want that info sitting around in a plain text file, simply edit $HISTFILE to get rid of the offending line, then use fc -R
to reload the history file. 😎
A couple of tips:
- zsh history is often kept in
~/.zsh_history
but that path can be confirmed by doingecho $HISTFILE
. - your
~/.zsh_history
might be massive, butvim
can load it without trouble. Assuming you havevim
, open the history file withvim ~/.zsh_history
, pressesc
, then useshift + G
to jump to the end of the file. Delete the offending line withD
then save with:wq
. - if you confirm with
history
it will show the unneeded line still, so do thefc -R
to reload the history file you just edited and saved.