It happens a lot that I need to reuse a command that I've already typed a little while back. What I use in those cases is reverse-i-search, which works like this:
- Hit CTRL+r
- Start typing part of the command you're looking for, not necessarily the beginning.
- Shell shows the last command you typed that matches the search.
Now you can do the following:
- Use CTRL+r again to move up in the history to next matching command, or CTRL+SHIFT+r to move down.
- any other key quits search and leaves you at the found point in your history, using the normal behaviour of that key. So ENTER executes the found command, etc.