A neat little trick for getting around the terminal history is by using the “reverse-i-search” feature of the terminal. To use this, simply hit [ctrl+r] in the terminal. What you’ll see is
Simply start typing and it will find previously used commands. You can hit [ctrl+r] again to search through the history if there is more than one match. For example, I typed in “hi” and it found the text pattern in my history of the command “which ifconfig”. At this point, I can hit [enter] and it will re-run the command or I can modify the command if I choose with the arrow keys like normal.
(reverse-i-search)`hi': which ifconfig