Hack 52. Repeat previous command quickly using 4 different methods

Sometime you may end up repeating the previous commands for various reasons. Following are the 4 different ways to repeat the last executed command.

  • Use the up arrow to view the previous command and press enter to execute it.
  • Type !! and press enter from the command line.
  • Type !-1 and press enter from the command line.
  • Press Control+P will display the previous command, press enter to execute it.