When you’re typing in Terminal, it’s easy to access the commands you’ve previously typed with the Up arrow on your keyboard. This can be handy when you have to re-type a long, complicated command. Simply hit the up-arrow and you’ll get the previously entered command.
Hit the up-arrow again, and you’ll get the command you entered before that, and so on, cycling through in reverse order until you get to the very first command entered in that particular Terminal window.
Turns out, you can do a similar thing in Messages, too.