How to remove an entry from the history in ZSH
*BSD/Darwin (macOS): LC_ALL=C sed -i ” ‘/porn/d’ $HISTFILE Linux (GNU sed): LC_ALL=C sed -i ‘/porn/d’ $HISTFILE This will remove all lines matching “porn” from your $HISTFILE. With setopt HIST_IGNORE_SPACE, you can prepend the above command with a space character to prevent it from being written to $HISTFILE. As Tim pointed out in his comment below, … Read more