I wanted to ree execute the command I executed nth command ago using the history command but I have no clue how to do it. and also I want to execute the last command I used which name begins with let's say 'm'.
!-2
and !m
.
See the chapter HISTORY EXPANSION in the bash man page.