The shell lets you recall commands that you've previously entered; use the up and down arrows to move through the history buffer. You can edit the command, if you wish, and then press Enter to reexecute it.
The shell also includes a builtin fc command that you can use to display and edit previous commands, as well as an r alias to fc that reexecutes a previous command. For example:
r string
reexecutes the last command that starts with the given string.