shells keep a history. The default seems to be to keep 1000 lines. I have not found a reason to make this huge. And while at it time stamp it as well:
HISTFILESIZE=2000000
HISTSIZE=100000
HISTTIMEFORMAT='%F %T '
export HISTTIMEFORMAT HISTSIZE HISTFILESIZE
in your .bashrc will keep 100,000 lines (2MB “omg” ) of history around and will also time stamp it nicely. That and the grep command make for some nice shortcuts on memory lane.