To see and choose previous commands, use the up arrow. Up to 500 of your last commands are stored in .bash_history (note the period before the file name).
To automatically run the previous command, use this:
To run a command that you ran a while ago, use !<command>, like this:
To see the list of commands in .bash_history, use:
To see a specific number of commands from history, use history <number>, like this:
You can also use grep with history to find a specific command, like this:
history | grep m
This causes the entire history list to be sent to grep, which then prints to the screen only those commands that begin with m.