Using bash type
Note that if you type the command
history all the commands that you typed will be displayed, preceded by an index. To recall a command that is indexed by the number X just type
!X (no space after the exclamation mark). If you type
!! the last command will be re-executed.
Sometimes you want to know when a certain command was executed. Just set the following environment variable:
export HISTTIMEFORMAT="%F %T "
Now the history contains also the time stamps associated to each command.