Do you need help remembering that cool command your coworker showed you 10 hours ago? The $ history and $ grep commands are your friend. Here is how you can search your last 500 commands for the word “revert”:
$ history | grep revert
The $ history command in isolation simply returns a list of your 500 latest commands and it is not terribly useful, per se. When the standard output of the history command is piped into grep for parsing, the command becomes invaluable.
If you are just looking for your most recent commands (say your 20 most recent commands) it is best to pipe the standard output from history to the tail command:
$ history | tail -20