Deleting a line from bash historyEdit
$ history -d 23
Alas, I haven't found an equivalent of this for Zsh, short of editing the ~/.history file by hand.
That's the case for "after the fact" deletion. To prevent something from being added to the history in the first place you can prefix the command with a space.