How to make bash (Terminal.app) remember history of previous sessions?
You'll need to tell bash where to keep your history file, and how many lines to keep:

# Set the location of your HISTFILE
echo "export HISTFILE=/Users/&lt;USERNAME&gt;/.bash_history" &gt;&gt; ~/.bash_profile

# Number of lines to keep (1000 in this example)
echo "export HISTFILESIZE=1000" &gt;&gt; ~/.bash_profile

# Set how many commands to keep in the current session history list
echo "export HISTSIZE=80" &gt;&gt; ~/.bash_profile

# Ignore commands that start with a space
echo "export HISTIGNORE=\"&amp;:[ ]*:exit\"" &gt;&gt; ~/.bash_profile