iTerm2: Clear Scroll Back History with Command + K
Pressing Command + K in iTerm2 clears the entire scroll back history buffer, permanently removing all previous output from the session. Control + L only clears the visible screen but leaves the scroll back history intact, meaning past output reappears when you scroll up. Use Command + K whenever you need a completely fresh, history-free terminal session.
I frequently forget this command shortcut, so this post is simply because I am lazy. To clear your history in iTerm press Command + K. Control + L only clears the screen, so as soon as you run the next command you will see the scroll back again.
If you want to view your command history (for terminal) type:
$ ls -a ~ | grep hist
.zsh_history
$ cat .zsh_history