Typically when you type a shell command its recorded in the bash history. If you ever needed to see what you typed in the past, a useful tool is the
history command. By typing
history in the shell it will display a list of commands (commonly the last 500) in the shell.
2 mkdir testdir
3 cd testdir/
4 vi testdoc
6 cd ..
7 rm -r testdir/
One of the benefits of the history command is if there is a command in your history you wish to execute again. You can do so by typing !<history number>.
Using the history list above, typing
!2 would execute the command
mkdir testdir again.