Search Your Terminal History
Ctrl-R is one of my favourite terminal commands. Type it, and you can search the history of commands you've typed without having to remember the command.
For example, I often use it with git. I can never remember the command to force-push a branch after rebasing, but I know it contains the word "force". So I type Ctrl-R, the "force", and it brings up the command I want:
git push --force-with-lease.
Note that I didn't have to type "git"; you can search for any part of the command that you remember, even something in the middle, and the whole command will be suggested. And if you don't want the first result, you can keep pressing Ctrl-R to cycle through the search results. When you find the command you want, just type Enter to run it.
Published on 8 January 2022