Search code examples
bashinteractive-shell

I want to re execute the command used nth command ago and last command which name begins with m


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'.


Solution

  • !-2 and !m.

    See the chapter HISTORY EXPANSION in the bash man page.