So Matlab has this really nice feature that if you type the start of a command in the terminal window and then press the up button you can browse through previous commands containing that text. This is a really nice feature when changing commands often. The terminal should really have this feature it would make things much less unwieldy. Thankfully it exists! After some search I found this post. It turns all you have to do is add the following lines to your ~/.inputrc file(if it don’t exist create it)
## arrow up
"\e[A":history-search-backward
## arrow down
"\e[B":history-search-forward
Restart the terminal. Now enter for example cd and press the up and down arrows to browse through your command line history on that command. Pretty awesome.