Tip for bash users: Control-r allows you to search your history for specific lines you’ve used in the past. After hitting control-r, you’ll see a prompt like this:
Start typing what you’re looking for, and the most recent matching command will appear after the prompt. Hit enter to run that command.
If you want to go back earlier than the command currently on the line, keep hitting control-r to cycle through matches in your history.