less than 1 minute read

You recently ran a long shell command that you need to run again, like mvn -D test -lots-of-more-options?

Solution:
Press “CTRL + R” (or “CMD + R” on Mac) to begin searching through your recent command history (in reverse order), then type what you remember about the command (like mvn if it was a Maven command).

Press “CTRL + R” repeatedly until you find the desired command.
“CTRL + G” to close the reverse search. “Enter” to run the command.

I find that this not only saves me time, but also energy and focus by reducing context switches.

(This should work in bash and most similar shells like zsh, including Git Bash on Windows.)