The history command in the Linux terminal
To use the history command, just type history:
history
Executing it will show you a list of past commands you used in the terminal.
Executing past commands
You can execute one of the commands shown by the history command by typing the exclamation mark character (The ! symbol) and the number beside the command:
!the-number-beside-the-command-you-want-to-execute
For example, if you want to execute the command that has the number 1 beside it, you type:
!1
If you want to execute the command that has the number 2 beside it, you type:
!2
If you want to execute the command that has the number 3 beside it, you type:
!3
You get the idea.
Executing your most recent command
You can also execute your most recent command by typing two exclamation points in the terminal:
!!