Bash Terminals in Linux and macOS have this nifty search called “reverse search” or reverse-i-search which you can invoke by typing a few keywords from your desired command and then pressing Ctrl + R.
Companion article: https://www.amitmerchant.com/search-h...