it's a shell feature, you have it on bash or tcsh, and each shell has it's own way of retrieving commands ... so the answer to your question is : use bash or tcsh, and if you use something else, for example ksh, then read the man to know how to retrieve commands
BTW : I think that ksh (using set -o vi) has a much more powerful system ofmanaging old commands than the up/down arrows !!
In the ksh, you will probably need to set up a couple of aliases if they are not already set (list aliases using the alias command), as follows:
alias history='fc -l'
alias r='fc -e -'
This will then allow you to list previous commands by typing history, and recall a prev. command with r xxx (where xxx is either the number of the command in the history list, or the first few characters of the command).
In addition if you issue the command set -o vi then you can use the escape key to get into 'command line editing mode' from there, use vi navigation keys (k for prev. command, j for next, l for cursor right, h for cursor left), and vi editing keys (x, p, r etc.) to modify commands.