Shamelessly copied from this tiny twitter thread by Kristian Köhntopp
Search history for the last command starting with keks
Search history for the last command containing keks
Repeat the previous command, after replacing keks with cookie
$ shopt -s histverify
Show result of above history expansion before exec.
rm -rf keks
Starting a command with a space will prevent it from entering the history.
$ unset HISTFILE
unsetting HISTFILE or HISTFILESIZE will prevent the shell from logging commands
And of course, as mentioned later in that discussion: