Both the bash and ksh93 shells record a history of all of the commands that you run. This history is kept on a per-user basis, which means the history is persistent between login sessions, as well as representative of all your login sessions.
For example, if you are in a bash shell, you can display the complete history of the commands that you have run as follows:
$ history 1 ls 2 ls -a 3 pwd 4 whoami . . .
To display a number of previous commands, include an integer in the command:
$ history 2 12 date 13 history
For more information, see the history (1) man page.