Although piping the history command through grep is definitely the easiest way of accomplishing some procedures, it isn’t ideal in many situations.
Bash includes search functionality for its history. The typical way of utilizing this is through searching backwards in history (most recent results returned first) using the CTRL-r key combination.
For instance, you can type CTRL-r, and begin typing part of the previous command. You only have to type out part of the command. If it matches an unwanted command instead, you can press CTRL-r again to see the next result.
If you accidentally pass the command you wanted, you can move in the opposite direction by typing CTRL-s. This also can be useful if you’ve moved to a different point in your history using the keys in the last section and wish to search forward.