Repeating commands in the Linux/OSX terminal is easy - press 'up' and the last command you entered will appear. If you're looking for a command you typed yesterday or a week ago though, it's still pretty simple!

History

The history command lists out all of the commands you've entered along with a number - to repeat the command, type ![number]:

!456

This will repeat the 456th command in the history.

If you've got a lot of commands in history, then you can filter the list to make it easier to find the correct command by using grep:

history | grep 'curl'

The history list will now be filtered to only show commands which contained 'curl', which makes it easier to find the command you're looking for.

Ctrl+R

Another handy shortcut for repeating commands is Ctrl+R - this will search through your terminal history, so as long as you remember some of the command, this is a quick way to find it.