You can press up-arrow or down-arrow to walk through a list of previous commands in most modern shells like bash, tcsh, fish, zsh and others in #Linux / #FreeBSD / #macOS/ #Unix. Another option is to hit CTRL+R & type the command to recall. See:
help history
man bash
man fish
man zsh
@nixCraft