While your in a terminal you can use the up arrow to view previous command and this is usually ok for the last few commands but if its any more than that it can become tedious to find it.
To find a command used recently run
Make sure to put the space before the command as this stops that current command being added to the history
history | grep "PART OF COMMAND"
To run the command last run again
To run the last command starting with something i.e ifconfig
!! also the same as !-1
To run the command second most recent