This is not a feature of iTerm, but a feature of the history of your shell. If you use standard Bash, you can put it in your ~/.bashrc :
export HISTCONTROL=ignoreboth shopt -s histappend
The first line tells Bash to ignore duplicate and empty history entries. The second line will combine the history of several open sessions (for example, in several tabs or windows). The thirs line will ensure that history is maintained after each command.
source share